if ($runAutomatic eq "n"){ print "No run automatic";
}
if ($skipCaseClean eq "n") { print "No skipping bad cases";
$i=1;
}
print "calling";
system "perl slp.pl" || die "Cannot open"
But when i run the main program using the command
sh sam.sh
The output is as below.
This is from slp.pl
Directory is cr_incr08292005
No run automatic
No skipping bad cases
calling
So the problem is when ever the external perl program is invoked "the system command is called first and then rest of the statements in th program is executed". Please provide me the solution for this problem.
if ($runAutomatic eq "n"){ print "No run automatic\n\n";
}
if ($skipCaseClean eq "n") { print "No skipping bad cases\n\n";
$i=1;
}
print "calling\n\n";
system "perl slp.pl" || die "Cannot open"
Ths program slp.pl is as below.
#!/usr/local/bin/perl
print "This is from slp.pl\n\n";
But when i run the main program using the command
sh sam.sh
The output is as below.
This is from slp.pl
Directory is cr_incr08292005
No run automatic
No skipping bad cases
calling
So the problem is when ever the external perl program is invoked "the system command is called first and then rest of the statements in th program is executed". Please provide me the solution for this problem.
if( -d $ARGV[0]){print"Directory is $ARGV[0] \n\n"; }
if($runAutomatic eq 'n'){print"No run automatic. \n\n"; }
if($skipCaseClean eq 'n'){print"No skipping bad cases. \n\n"; }
system("perl slp.pl")ordie("Cannot open.");
Here's what I've done:
1. I cleaned up the alignment and formatting of your syntax.
2. I took out the seemingly useless $i = 1; assignment from the third "if" conditional.
3. I literalized the system() command, and threw in some parenthesis for sanity's sake.
4. Most importantly I added a semi-colon after the die() command.
I hope that fixes things up for you.
EDIT: Keep in mind, Perl's syntax is ugly as is, so - and this goes to everyone who writes in Perl - try and make your code as visually appealing and as un-cryptic as possible; one command/small conditional/assignment a line.
Last edited by indienick; Jul 24th, 2006 at 6:04 pm.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.