in reply to Re^2: "CGI::param called in list context" confusion
in thread "CGI::param called in list context" confusion

Look again at the example I gave in my above code. Submitting more than one value for foo allows you to swap keys and values in the call to the function or to insert additional keys into the call.

For example if your code is

#!perl -w use strict; use CGI; use Data::Dumper; sub do_foo { my( %params )= @_; print Dumper \%params; if( $params{ is_admin }) { print "Is admin\n"; } else { print "No admin\n"; }; }; my $q= CGI->new(); do_foo( is_admin => 0, foo => $q->param('foo') );

... then you can test various incantations from the command line:

perl -w test.pl foo=1 perl -w test.pl foo=bar perl -w test.pl foo=0&foo=is_admin&foo=yeah&foo=another_parameter&foo= +yippieh