Mike Blezien wrote:
Gunnar Hjalmarsson wrote:
Mike Blezien wrote:

foreach $sparam (param()) { ${$sparam} = param($sparam); } # line 151
-----------------------------^^^^^^^^^^^^

Maybe it's that; hard to tell since you don't give more context. But what you are trying to do, i.e. using symbolic references, is unnecessary and considered bad programming practice.

The standard way to avoid it is to use a hash instead of a bunch of scalars. In the case of CGI parameters, you can simply do e.g.:

    use CGI;
    my %param = new CGI->Vars;

That would give you all the parameters conveniently available in the %param hash.

Thanks for the suggestion. We've used this type of coding scheme before with no problems in the past, but wasn't aware it was considered "bad programming" practice.

It's explained in the Perl FAQ:

    perldoc -q "variable name"

Sorry for not providing that reference in the first place. ;-)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to