in reply to Re: I think Perl ruined me as a programmer
in thread I think Perl ruined me as a programmer
that min functions looks kinda funny, and in some ways manages to expose the dangers of writing lazy (ie, terse) perl.
produces: min of 10 10 10 10 10 10 is 10sub min { my $min = shift; foreach (@_) { $_ = $min if $_ < $min; } return $min; } @a = (10, 5, 8, 2, 1, -4); $min = min(@a); print "min of @a is $min\n";
probably not what you expected! not only did it give the wrong answer, it destroyed the input list!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: I think Perl ruined me as a programmer
by Anonymous Monk on Nov 14, 2008 at 23:51 UTC | |
by Anonymous Monk on Apr 12, 2010 at 05:36 UTC | |
by Anonymous Monk on Apr 12, 2010 at 05:45 UTC |
In Section
Meditations