LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to pass in a parameter to a perl script (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-pass-in-a-parameter-to-a-perl-script-605518/)

new_2_unix 12-09-2007 12:18 AM

how to pass in a parameter to a perl script
 
hi,

i'm having a problem a problem where i'm trying to call a perl cgi script from another perl cgi script and i want to pass in parameters with the call.

i've something very similar which works: if i have a html link with "<a href..." then in this link i can pass in parameters in the manner: "myscript.cgi?name=value" and i'm able to read 'name' in myscript.cgi.

however, problem occurs when i cannot have a link because i don't want the user to click on anything and basically, at a certain point in my perl cgi script i want to transfer control over to another perl cgi script. so to do this, i am using the system command in the manner:

Code:

system("/usr/bin/perl myscript.cgi?name=value"
this causes a HTTP 500 error on the browser. i've tried to look up examples on how to do this but i'm still kind of at a loss on understanding how to do this. any guidance will be infinitely helpful. thanks!

winfinit 12-09-2007 12:37 AM

you can do that via global values, you can load up all you necessary data into hash and then load that globally declared hash into any script. if you can provide me with 2 examples, and what are you trying to pass to another script, i might help you, and give you examples on how to pass hash to another script.

new_2_unix 12-09-2007 12:48 AM

i've a username scalar variable, about which i want to know in any script that i'm in. i'm somewhat familiar with global varialbes in perl. does this just mean that i need to declare an 'our' hash? but how do i access this then? thanks for your help.


All times are GMT -5. The time now is 01:02 PM.