Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter passing with backtick

Status
Not open for further replies.

ranadhir

Programmer
Nov 4, 2003
54
IN
Hi.
i am trying to read in a file at command line with a perl script.
It then executes another perl script using backtick,with the read data.
But something strange happens in this sequence.
The file which is read in contains certain entries having quote encapsulated data - a typical example being:

<value>#Obj ClassName="Application" RepositoryName="Agent"@#Obj ClassName="PageTabs" RepositoryName="PageTabs"/@#/Obj@;GotoScreen;"Shopping Screen"</value>


Though this data is read in properly,when it passed in within backtick,the quotes disappear.

Heres the code sample
use strict;

my $holdTerminator = $/;
undef $/;
my $buf = <STDIN>;


my @lines = split /$holdTerminator/, $buf;
$buf = "init";


$buf = join "", @lines;
$buf =~ s/\s+/~/g;#replacing space with ~

my $transaction="'${buf}'";
my $commandline="perl service_test.pl -txnDetails $transaction ";

print "$commandline";

my $returnargs=`$commandline`;
print $returnargs;

In the service_test.pl,printing out the parameter sows that quotes have vanished.How can i pass the parameter in ,with the quotes intact?
 
Thanks it worked!!!but just for refreshing the basics - whats the difference in the interpretation of what i did and what you correctly suggested?Sorry for such a naive question - but i am quite a beginner in perl.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top