Plankton has asked for the wisdom of the Perl Monks concerning the following question:
How would it look if I used map? I know this isn't it ...sub add2array { my $ref2array = shift; my $obj = new THING; for my $thing ( sort keys $obj->things ) { push ( @{$ref2array} $thing ); } }
... or is it?$ref2array = map { push @{$_} } sort keys $obj->things;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How would I write this using map?
by kwaping (Priest) on Jan 12, 2009 at 23:55 UTC | |
Re: How would I write this using map?
by monarch (Priest) on Jan 13, 2009 at 00:38 UTC | |
Re: How would I write this using map?
by jwkrahn (Abbot) on Jan 13, 2009 at 00:39 UTC | |
Re: How would I write this using map?
by trwww (Priest) on Jan 13, 2009 at 04:13 UTC | |
by puudeli (Pilgrim) on Jan 13, 2009 at 11:04 UTC | |
by monarch (Priest) on Jan 13, 2009 at 23:56 UTC | |
by trwww (Priest) on Jan 14, 2009 at 00:17 UTC | |
by trwww (Priest) on Jan 14, 2009 at 23:51 UTC |