good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: max value in a hashby mscharrer (Hermit) |
on Sep 15, 2008 at 08:28 UTC ( [id://711408]=note: print w/replies, xml ) | Need Help?? |
Hi, while you already got a solution for your problem I would like to comment on your code. You seem to use a foreach loop only to abort it in the first iteration which you don't really have to in Perl. It looks very C'ish to me.
First, instead of: you could write: because there is no need for the $i when you just check for 0. Second, even easier in Perl, you can index returned lists when you put them in ( ): or simply by doing an array assignment: also the ( ) around and after keys aren't necessary and avoiding them would make the code more readable.
In Section
Seekers of Perl Wisdom
|
|