in reply to s// with e option : evaluate, quote, evaluate
To take this further, your grep should probably be a map. You likely shouldn't be using &fun(@arg) unless you know what the & is doing. Also, for anything more complex - you probably should use a block:
for my $thing (grep defined, @oldlist) { if (/(\d+-PVC_\d+)/) { my $item = $1; my $str1 = foo($item) || ''; my $str2 = bar($item) || ''; push @newlist, $str1 . '/' . $str2; } else { warn "Do not know what '$thing' is\n"; } }
Cheers - L~R
|
|---|