Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

CGI.pm: Can't modify non-lvalue subroutine call

by slugger415 (Monk)
on Mar 22, 2019 at 22:50 UTC ( #1231577=perlquestion: print w/replies, xml ) Need Help??

slugger415 has asked for the wisdom of the Perl Monks concerning the following question:

Hello esteemed PerlMonks. I want to assign the value of one variable returned from a CGI.pm script, if it exists, to another, e.g.:

if($q->param('product_key_text')){ # if was entered in the text field, # set it to product_key $q->param('product_key')=$q->param('product_key_text'); }

But I'm getting this error when text is entered in product_key_text:

Can't modify non-lvalue subrutine call

I gather I'm trying to modify a param that can't be modified; how do I do this? Thanks!

Replies are listed 'Best First'.
Re: CGI.pm: Can't modify non-lvalue subroutine call
by hippo (Bishop) on Mar 22, 2019 at 23:02 UTC

    The correct way to set the value of a parameter to that of another is this:

    $q->param ( -name => 'product_key', -value => $q->param('product_key_text') );
      Perfect! thank you for the quick reply.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1231577]
Approved by Paladin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2022-01-21 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?