Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: CGI Action call

by Corion (Pope)
on Mar 12, 2018 at 18:13 UTC ( #1210745=note: print w/replies, xml ) Need Help??


in reply to Re^2: CGI Action call
in thread CGI Action call

my %hash = shift;

This can never work and likely never is what you intend it to be. See shift.

Most likely, the correct code you wanted is

my %hash = @_;

... given the way you call completeResultHash.

Replies are listed 'Best First'.
Re^4: CGI Action call
by tultalk (Monk) on Mar 12, 2018 at 20:43 UTC

    My undestanding:

    my $a = shift; 1st item my $b = shift; 2nd item (if exits etc since it was bumped up to top by + pervious shift. my ($a, $b) = @_; my $a = $query->param('a'); my $b = $query->param('b');

    These are all the same.

      What you wrote above has nothing to do with the assignment of subroutine parameters.

      shift will only move one element from the parameter list. A hash will occupy multiple slots in the parameter list. You need to learn about how Perl passes parameters in subroutine calls.

      param(...) is only for CGI parameters and has no bearing on subroutine parameters.

        param(...) is only for CGI parameters and has no bearing on subroutine parameters.

        Winder why I thought or assumed that?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1210745]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2018-07-21 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (448 votes). Check out past polls.

    Notices?