eileen1017
MIS
I have this written script below:
$driver_list="/dsk01/apps/toshiba/oracle/perl/print_driver_list.fle";
open (LIST, $driver_list)||die "Can't open driver list file!\n";
$count = 0;
while ($line = <LIST>) {
($a1,$a2) = split(/:/, $line);
#print "$a2"; #for debugging
$a3 = substr($a2, 0, 1);
#print "$a3\n"; #for debugging
if ($a3 eq "e")
{
opendir (DIR, "/dsk01/apps/baan1/bse/lib/printinf/e");
foreach $file (readdir(DIR)) {
next if $file =~ /^\./; # skip ., .., etc
#print "$file | $a2\n"; # for debugging
if ($file eq $a2) {
$obj1="/dsk01/apps/baan1/bse/lib/printinf/e/$file";
$obj2="/dsk01/apps/baan1/bse/lib/printinf/e_hold/$file";
#print "diff $obj1 $obj2 \n"; # for debugging
system ("diff $obj1 $obj2 >> /dsk01/apps/toshiba/oracle/perl/print_driver_file_comparison_result.rpt");
}
}
closedir (DIR);
}
$count++ }
close (LIST);
And for debugging purpose I print out $file and $a2 for comparison. It returned the following list:
epson_fx | epson_fx
epson_tic | epson_fx
test | epson_fx
epson_fx.nw | epson_fx
esc_p | epson_fx
epson_fx_rwb | epson_fx
epson_fx_SP9 | epson_fx
The thing I don't understand is that during one of the loop $file is equal to $a2 as shown by epson_fx | epson_fx; however, the statements in the if ($file eq $a2) block will not execute and when I change the eq to ne, it worked. Why is that?
$driver_list="/dsk01/apps/toshiba/oracle/perl/print_driver_list.fle";
open (LIST, $driver_list)||die "Can't open driver list file!\n";
$count = 0;
while ($line = <LIST>) {
($a1,$a2) = split(/:/, $line);
#print "$a2"; #for debugging
$a3 = substr($a2, 0, 1);
#print "$a3\n"; #for debugging
if ($a3 eq "e")
{
opendir (DIR, "/dsk01/apps/baan1/bse/lib/printinf/e");
foreach $file (readdir(DIR)) {
next if $file =~ /^\./; # skip ., .., etc
#print "$file | $a2\n"; # for debugging
if ($file eq $a2) {
$obj1="/dsk01/apps/baan1/bse/lib/printinf/e/$file";
$obj2="/dsk01/apps/baan1/bse/lib/printinf/e_hold/$file";
#print "diff $obj1 $obj2 \n"; # for debugging
system ("diff $obj1 $obj2 >> /dsk01/apps/toshiba/oracle/perl/print_driver_file_comparison_result.rpt");
}
}
closedir (DIR);
}
$count++ }
close (LIST);
And for debugging purpose I print out $file and $a2 for comparison. It returned the following list:
epson_fx | epson_fx
epson_tic | epson_fx
test | epson_fx
epson_fx.nw | epson_fx
esc_p | epson_fx
epson_fx_rwb | epson_fx
epson_fx_SP9 | epson_fx
The thing I don't understand is that during one of the loop $file is equal to $a2 as shown by epson_fx | epson_fx; however, the statements in the if ($file eq $a2) block will not execute and when I change the eq to ne, it worked. Why is that?