in reply to The trouble with Perl Idiom
That reads awkwardly, I find. This is how I'd write it:
sub getRef { my $self = shift; $_ = $self->getNodeById( $_ ) for grep { $_ and not ref } @_; return ref $_[0]; }
It maps more closely to the way I think of the problem. You can almost read it out in natural language: "filter it through $self->getNodeById() for every element that is true and not a reference".
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The trouble with Perl Idiom
by demerphq (Chancellor) on Aug 29, 2004 at 22:10 UTC | |
by Aristotle (Chancellor) on Aug 29, 2004 at 22:34 UTC | |
by demerphq (Chancellor) on Aug 30, 2004 at 07:00 UTC | |
by hv (Prior) on Aug 30, 2004 at 11:06 UTC | |
by demerphq (Chancellor) on Aug 30, 2004 at 11:21 UTC |