my %input = CGI::Vars;
The above performs the same as your proposed code but ties your array in with that used internally within CGI.pm for the storage of CGI parameters.
Of the proposed code samples provided however, map and grep would be poor choices as, in the examples given, these are being used in a void context, the return values built and returned by these functions discarded. With regard to for and foreach, according to perlsyn, foreach is merely a synonym for for, the choice between the two representing a balance for the programmer between readability and brevity.
In reply to Re: map, grep, for, foreach
by rob_au
in thread map, grep, for, foreach
by mt2k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |