in reply to How do I rewrite this foreach() loop as a map{} ?
First, I see you have \@{$hash{$_}} and similar contructs in your code.
I understand that $hash{$_} is a reference to the array, and you're dereferecing and taking reference again. Why?
I would just (using map):
@c = map { $hash{$_} } sort keys %hash;
I also se you're using a prototype of $$. Are you sure you know the implications?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How do I rewrite this foreach() loop as a map{} ?
by northwind (Hermit) on May 10, 2005 at 16:10 UTC | |
by jeffa (Bishop) on May 10, 2005 at 16:13 UTC | |
by northwind (Hermit) on May 10, 2005 at 16:32 UTC |