in reply to Unusual coding arrangements in Perl
Here's something from my recent web application:
my %immediate = map { m/(\d+)/; $1 => 1; } grep /m_immediate_/, (keys %{$cgi->Vars});
I have a bunch of check box controls in an HTML form, and this just gives me a hash containing the ones that are set. You have to read it from right to left .. first I get all of the keys from CGI's Vars hash, and keep only the ones containing 'm_immediate'; I collect the numeric part, make a hash element using the value, and put that into the 'immediate' hash.
Terse, powerful, simple. That's Perl.
|
|---|