《perl语言入门第四版(中文版)》 例程勘误 初

4.3

#!c:/perl64/bin/
sub sum_of_fred_and_barney{
print " Hey, you called the sum_of_fred_and_barney suroutine!\n" ;
$fred + $barney; #返回值
}
$fred = 3;
$barney = 4;
$wilma = &sum_of_fred_and_barney; #$wilma 得到 7
print " \$wilma is $wilma.\n" ;
$betty = 3 * &sum_of_fred_and_barney; #$betty 得到 21
print " \n$betty is $betty.\n" ;

4.10

#!c:/perl64/bin/ #strict pragma
sub list_from_fred_to_barney {
if($fred < $barney) {
$fred..$banrey;
}
else {
reverse $barney..$fred;
}
}
$fred = 11;
$barney = 6;
@c = &list_from_fred_to_barney;
print @c ;

你可能感兴趣的:(perl,勘误)