in reply to Creating vars from URI and printing %ENV

Creating variables using symbolic references is a very bad idea for reasons that are discussed on this site almost every day. Creating variables using symbolic references and taking their names from user data in a CGI script creates a huge security risk on your server. Please don't use code like this on a server connected to the internet.

Why not put the values in a hash like this:

my %param; foreach (param) { $param{$_} = param($_); }

or (if you have multivalued CGI parameters)

my %param; foreach (param) { # store all parameters in arrays initially push @{$param{$_}}, param($_); } foreach (keys %param) { # promote single element arrays $param{$_} = $param{$_}->[0] if @{param{$_}} == 1; }
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg