Hi, Jennifer Garner <[EMAIL PROTECTED]> asked: > I have a small script,when it run,it generate much more lines > and put them into a file. > The code for printing I writed: > > map { print RESULT $_,":",$ips{$_},"\n" } > sort { $ips{$b} <=> $ips{$a} } keys %ips; > > Certainly, I can write that code with foreach style. > I want to know which method is more effective between foreach and map?
Don't use map in a void context. If you're not interested in building a list of the map()'ed values, use foreach. HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>