vtumati
asked on
Passing an Array as an Input to perl
Hi,
I need to pass an array as an input to an perl script something like this
sending file
<a href="testsum_pc.pl?path=$ path" target="pathcommand">Path< /a>
receiving file
$path_command=$q->param('p ath');
print "$path_command \n";
that works when i send a small string, I tried to send a big array with various special charcters. Only part of the arrray seems have to have passed rest of it got truncated
sending file
<a href="testsum_pc.pl?path=@ command" target="pathcommand">Path< /a>
receiving file
@path_command=$q->param('p ath');
print "@path_command \n";
when i do this only part of the input is transmitted.
Can i get some code on how to exactly pass an array with special charcters as input to another perl script.
-V
I need to pass an array as an input to an perl script something like this
sending file
<a href="testsum_pc.pl?path=$
receiving file
$path_command=$q->param('p
print "$path_command \n";
that works when i send a small string, I tried to send a big array with various special charcters. Only part of the arrray seems have to have passed rest of it got truncated
sending file
<a href="testsum_pc.pl?path=@
receiving file
@path_command=$q->param('p
print "@path_command \n";
when i do this only part of the input is transmitted.
Can i get some code on how to exactly pass an array with special charcters as input to another perl script.
-V
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I dont really care for the result to be an array all I want to do is to display the value. I want to be able to send an array as an input to another perl script and I want to display the sent value.
-V
-V
ASKER
Let me rephrase my question all I want to do is to send the value in @command to another perl script so I can print it on the webpage. The @command array has a lot of "specialCharcters"
Please include code.
-V
Please include code.
-V
What I put in above will work for what you said.
ASKER
I tried it and all i get is the first word in the array the second word happens which is does not work -abcd
This is the code i Used
<FORM METHOD="post" ACTION="testsum_pc.pl" target="pathcommand">
<INPUT NAME="command"> <P>
<INPUT TYPE="HIDDEN" NAME="COMMAND" VALUE=@command>
<INPUT TYPE="submit" VALUE="Command"> <P>
</FORM>
@command = $q->param('COMMAND');
print "@command \n";
When i just ran the script from the command line, the VALUE field had all the contents of @command, am i doing something wrong.
-V
This is the code i Used
<FORM METHOD="post" ACTION="testsum_pc.pl" target="pathcommand">
<INPUT NAME="command"> <P>
<INPUT TYPE="HIDDEN" NAME="COMMAND" VALUE=@command>
<INPUT TYPE="submit" VALUE="Command"> <P>
</FORM>
@command = $q->param('COMMAND');
print "@command \n";
When i just ran the script from the command line, the VALUE field had all the contents of @command, am i doing something wrong.
-V
If I was you I'd create the hidden input by using the interface provided in CGI.pm as I described above (almost copy and paste the code). That's the way the documentation says to do it! :-)
ASKER
Here is the What my final form looked like
page1
<FORM METHOD="post" ACTION="testsum_pc.pl" target="pathcommand">
<INPUT TYPE="HIDDEN" NAME="COMMAND" VALUE=/'@command'>
<INPUT TYPE="submit" VALUE="Command"> <P>
</FORM>
page2
@command = $q->param('COMMAND');
print "@command \n";
I was missing the ' ' on the command
page1
<FORM METHOD="post" ACTION="testsum_pc.pl" target="pathcommand">
<INPUT TYPE="HIDDEN" NAME="COMMAND" VALUE=/'@command'>
<INPUT TYPE="submit" VALUE="Command"> <P>
</FORM>
page2
@command = $q->param('COMMAND');
print "@command \n";
I was missing the ' ' on the command
Are you encoding the "special" characters in the path?