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; }
In reply to Re: Map and Grep
by repson
in thread Map and Grep
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |