in reply to Re^2: Temp variable performance vs Inline behavior
in thread Temp variable performace vs Inline behavior

You could use the same technique but clobber a temporary array instead...

my @devices = grep { defined($_ = parse_node($_)) } my @tmp = @nodes;

Or you could use map:

my @devices = map { my $x; defined($x=parse_node($_)) ? $x : () } @nodes;

If parse_node was written to return the empty list in cases of failure (rather than returning the scalar undef), then it would just be:

my @devices = map { parse_node($_) } @nodes;
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'