2009/10/25

perl note part2

1.      @line= <STDIN>

Chomp(@line)

print @line;

CTR+D in linux CTR+Z in window to end of standard input

2.      A lot of default

Sub list_from_a_to_b{

            If ($a>$b){

            $a;

            }

            Else{

            $b;

            }

}

$a, $b are global variables. No return needed

Or use

Sub list_from_a_to_b{

            ($a,$b) = @_

Or use

$a = $_[0];

$b = $_[1];

 

No comments:

Post a Comment