in reply to Map and Grep
Using the functions map and grep saves us typing these commonish constructs every time we need them.# @out = map { EXPRESSION } @in my @out; foreach $_ ( @in ) { push @out, EXPRESSION; } # @out = grep { CONDITION } @in my @out; foreach $_ ( @in ) { push @out, $_ if CONDITION; }
|
|---|