Thanks for all.maybe I would use Benchmark.pm <http://benchmark.pm/> to find out a good choice.
And, I have another syntax question here. I can't know clearly the difference between eval "" and eval {}. I have run "perldoc -f eval" and read it,but still can't know clearly.Can you help me on this? On 12/6/05, Bob Showalter <[EMAIL PROTECTED]> wrote: > > Jennifer Garner wrote: > > Hi,lists, > > > > 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; > > I would write it like this: > > print RESULT "$_:$ips{$_}\n" > for 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? > > I don't know without benchmarking, but map() is typically used to build > a resulting >