This is a discussion on Problem in using backtick Operator in Perl within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi, I am facing a weired problem with using backtick (` `) opertor in Perl. I am running a ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I am facing a weired problem with using backtick (` `) opertor in Perl. I am running a java api in shell using perl backtick operator. In my command i have two options (title and description) whose text have spaces and newline character. So when run the command with single/double quotes to give whole text in option i get the No class defined error. But when i don't use quotes to club this text then i get API error (Invalid options ). As API thinks anything after one word as options. When i run on my shell(ksh) command prompt, it runs fines no error do it job. Even in perl without quotes (used for this 2 options) in bactick it works fine. But i need these 2 options for my porgram, My perl version is 5.6.0 and aix version 5.1. But i checked on other Perl and AIX versions and same problem I have checked all the env variables and they are set fine. +++++++++++++++ $ENV{CLASSPATH}='/usr/work/ticket/JTicketClient.jar:.'; my $cmd = 'java JTicket.JTicketClient -i TICKET -n process_name -j p' # for this no error my $cmd = "java JTicket.JTicketClient -i TICKET -n process_name -j p -t 'This is title' -d 'This is description' " # for this i am getting error $ticket_dir = '/usr/work/ticket' chdir $ticket_dir; my $result = `$cmd`; die "Error Invalid return from Java API - $?:" . Dumper($result) if ( $? != 0); print "$result\n"; chomp($result); unless ($result) { warn "Invalid return from Java API : $result"; return $result; } ++++++++++ I have tried to use pipe even Safe pipes but no luck. Can somebody help me. Also i written this small code to check this is becuase of quotes ++++ #!/usr/bin/perl -w use Data: $test = "'Perl is language'"; $res=`echo $test`; print Dumper(\$res); on running i am getting extra two new lines $ perl test.pl $VAR1 = \' ram is name '; ~ +++ Tried to used escape sequence but problem presists. Thanks, Sanjay |