Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How do I get a reference to a subroutine return value? - or is it "how do I get cgi parameters into a subroutine"

by bjelli (Pilgrim)
on Mar 03, 2001 at 03:22 UTC ( #61931=note: print w/replies, xml ) Need Help??


in reply to How do I get a reference to a subroutine return value?

I'm not too sure I understood the question, I assume you want to get all the CGI-Paramers into your subroutine like so: myfunc(return => query->param("return"), authors => query->param("authors"));

The short answer: myfunc(  map { $_ => [$query->param($_)] } $query->param()  );

the long answer:

Get a list of all the parameters with $query->param(). This will be fed into map.

Map can be used to apply some commands to every element in a list, and construct a new list from the result. In this case for every element you feed into the map, you get back two elements: you get back the key, and an anonymouse array with the values.

that's it -- Brigitte 'I never met a chocolate I didnt like' Jellinek http://www.horus.com/~bjelli/ http://perlwelt.horus.at

  • Comment on Re: How do I get a reference to a subroutine return value? - or is it "how do I get cgi parameters into a subroutine"
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://61931]
help
Chatterbox?
and the leaves swirl about...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2018-05-27 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?