http://www.perlmonks.org?node_id=35475


in reply to How do I pass a sequence of variable names to a subroutine one at a time?

How about:
use strict; foreach ($query->param) { do_stuff($_) if /^c\d+$/; } sub do_stuff() { my $cd = shift; my $value = $query->param($cd); # blah }
param() returns the names of all the parameters when called with any arguments. See the CGI docs.

Originally posted as a Categorized Answer.