> I am running a perl script as below which is working perfectly and want to
> replace the hardcoded values with variables.
> (the script accepts space as the delimiter)

> @respon = $placesock->print("./test.pl \"7741266\" \"DEM EXPO\"
> \"255.255.255.255\" \n");
>
> and i am doing this
>
> @respon = $placesock->print("./test.pl." ".$param1." ".$param2." ".$param3
> \n");
>
> Whats the mistake i am commiting.

The simple answer is that you are forgetting to escape "
Really, I think you're getting confused about when you are in the "s and
when you aren't.


The more complicated answer is how to get what you want.  I'll give it a
try:

@respon = $placesock->print("./test.pl \"".$param1."\" \"".$param2."\"
\"".$param3."\" \n");

but that is way more complicated than it needs to be, since " will replace
$var with it's value, so you should be able to do:

@respon = $placesock->print("./test.pl \"$param1\" \"$param2\" \"$param3\"
\n");

for me, that's a little hard to read, but others may prefer it.  Another
option, if you don't put anything in "s that needs to be replaced would be:

@respon = $placesock->print('./test.pl "'.$param1.'" "'.$param2.'"
"'.$param3.'" '."\n");

All three of these produce the same output as the hardcoded version that you
gave us when given proper values for $params

> i m getting the following error message...
>
> String found where operator expected at mybly.pl line 263, near
""./test.pl
> . " " . $param1.""
>         (Missing operator before  " . $param1."?)
> panic: realloc at mybly.pl line 263.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to