CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
expanding a variable inside of a CGI param call

 



filmo
Deleted

Mar 3, 2001, 12:02 AM

Post #1 of 2 (229 views)
expanding a variable inside of a CGI param call Can't Post

I'm trying to design a subroutine that will allow me to pass variables to the $q->param() routine within the CGI module.

here's my code so far.

Code
sub Handle_Media { 
my $name = shift;
@Files = $q->param("$name_files");
@Delete = $q->param("$name_DEL");
more code here ...

If for example I passed "LIBRARY" to the subroutine, I want it to load into @Files all the values of the param "LIBRARY_files". I've checked that the values are being passed, so I know that's not the problem. How do I get it so @Files will be the values of the param named "$name_files"???

Thanks

--
Filmo the Klown


unknownSym
stranger

Mar 15, 2001, 7:03 AM

Post #2 of 2 (222 views)
Re: expanding a variable inside of a CGI param call [In reply to] Can't Post

Change your @Files and @Delete lines to this:

@Files = $q->param("${name}_files");
@Delete = $q->param("${name}_DEL");

or ...

@Files = $q->param($name . "_files");
@Delete = $q->param($name . "_DEL");

Those both should work. The second (although a few characters longer) should be more readable/understandable.


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives