How to pass string in command line argument.



hi ,

I want to pass a command argument to perl script with double quotes (" );


below is my scenario

my xml file is something like this ..


<root>

<reff>
<var1>123</var1>
<var2>this is my name</var2>
</reff>
<reff>
<var1>234</var1>
<var2>this is others name </var2>
</reff>
</root>

my perl script is something like this



my $xmlfile = "./samp1.xml";
my $ref = eval { XMLin($xmlfile) };

if ($@){

print "XML Read ERROR";

} else {

foreach my $item (@{$ref->{reff}}) {

system("perl C:\\Document and settings\\Desktop\\search.pl -n
\"$item->{var2}\"");

the search.pl file consists of .

print "AGRV[1]";



my out put is

this is my name

this is others name



i understand that the string is getting passed to the perl script with out
quotes ..



just a straight string is geeting passed (like this this is my name)

but i need to send the entire string including double quotes to the
script.,something like this ( "this is my name")

Waiting for your solutions....

thanks in advance

perl guy

Relevant Pages

  • Re: How to pass string in command line argument.
    ... > I want to pass a command argument to perl script with double quotes (" ... > just a straight string is geeting passed ...
    (perl.beginners)
  • Re: How to pass string in command line argument.
    ... i have perl script that searches given string (the string should be passed ... The string should be sent to the script with double quotes attached to it ...
    (perl.beginners)
  • RE: how to get datatype of columns of a table in perl script
    ... Subject: RE: how to get datatype of columns of a table in perl script ... consider using the placeholder/bind feature of DBI when you insert rows. ... write to get the data type and add quotes? ...
    (perl.dbi.users)
  • Re: executing a file
    ... I had gotten the perl script working standalone ... Doug Steele, Microsoft Access MVP ... My command now has quotes as per your example. ...
    (microsoft.public.access.formscoding)
  • Re: How to pass string in command line argument.
    ... I want to pass a command argument to perl script with double quotes; ... i understand that the string is getting passed to the perl script with out ... Under Linux, you could separate the arguments in the systemcall, like so: ...
    (perl.beginners)

Quantcast