Hello List,
I am having two conditions in the perl program. after the check it will be
regenerated to a valid or notvalid file depending on the check.
Checking " if (system($touchcmd) && system($chkstat)) " as condition. Is this a
valid one? also was trying to get this done buy calling subroutine.
My check are like this..
this was the initial one ...wanted to remove the second if...
if(CondA) {
if(CondB) {
#write to valid one }
else {
#write to notvalid file with different flag }
}
else {
# write to notvalid file with error flag }
This is the scratch book ...know its messy...and both CondA and CondB are
system commands (UNIX).
#!/bin/perl
$interfaces="Output - working interface";
$chkstat="cat tmp";
$touchcmd="touch test";
if (system($touchcmd) && system($chkstat)) {
print $?."\tyes stmt";
`echo $interfaces >>outfile.txt`;
}
else {
print $?."\tNo stmt";
`echo $_ >>notdone.txt`;
}
Is it good practice to check for $? in program? I haven't seen anybody using
that.
#sub testa {
# system($chkstat);
# $?;
#}
#sub testb {
# system($touchcmd);
# $?;
#}
Thanks
Manoj
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/