Hi Brandon,
Just a note about your code:
On Saturday 16 October 2010 06:53:29 Brandon McCaig wrote:
> sub print_sum
> {
> my ($a, $b) = @_;
>
> print($a + $b, "\n");
> }
You should not call lexical variables "$a" and "$b" because this interferes
with the "$a" and "$b" http://perldoc.perl.org/perlvar.html variables used in
perldoc -f sort and now other functions. Reading from there:
{{{
* $a
* $b
Special package variables when using sort(), see sort. Because of this
specialness $a and $b don't need to be declared (using use vars, or our())
even when using the strict 'vars' pragma. Don't lexicalize them with my $a or
my $b if you want to be able to use them in the sort() comparison block or
function.
}}}
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
List of Portability Libraries - http://shlom.in/port-libs
<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/