B
bobmct
I know my eyesight is getting bad but I'm pounding my head with this
rather simple unequal compare.
I have a text file, the starting portion of which appears below. The
fir field is a filename followed by a tab and the second field is a
full path
I simply wish to print the filename if/when it changes from the
previous record processed.
I've also printed some fields and logic results for debugging
purposes. The output of the debugging also appears below and of
course my code loop is there as well.
Can some of you please look at my unequal compare statement to help me
determine why it is NOT detecting a difference in MOST of the records?
Thanks
input file snippet
-------------------
- dsl line only service agreement 1.15.02.pdf C:\Documents and
Settings\bobm3\My Documents\My Files\pdf\
-Release Notes-.rtf C:\Documents and Settings\bobm3\My
Documents\My PaperPort Documents\Samples\
4622XL.cfg C:\Documents and Settings\bobm3\My
Documents\Source\netopia\
!finallo.bmp C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.bmp C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.jpe C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.jpe C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
# 001 bronze training form.wpd C:\Documents and Settings\bobm3\My
Documents\My Files\training contract unit lists\
# 001 gold training form.wpd C:\Documents and Settings\bobm3\My
Documents\My Files\training contract unit lists\
code snippet
---------------
# Process Sequence File Listing File
while (<IFH>) {
chomp;
($filename, $path) = split /\t/;
print "filename=[$filename],priorfilename=[$priorfilename]\n";
# Determine if filename should print
if ("$filename" != "$priorfilename") {
print "printing filename\n";
$priorfilename = $filename;
$~ = "OFH_Filename";
write(OFH);
} else {
print "NOT printing\n";
}
# Now output path info
$~ = "OFH_Detail";
write(OFH);
}
debugging output snippet
------------------------------
filename=[- dsl line only service agreement
1.15.02.pdf],priorfilename=[]
NOT printing
filename=[-Release Notes-.rtf],priorfilename=[]
NOT printing
filename=[ 4622XL.cfg],priorfilename=[]
printing filename
filename=[!finallo.bmp],priorfilename=[ 4622XL.cfg]
printing filename
filename=[!finallo.bmp],priorfilename=[!finallo.bmp]
NOT printing
filename=[!finallo.jpe],priorfilename=[!finallo.bmp]
NOT printing
filename=[!finallo.jpe],priorfilename=[!finallo.bmp]
NOT printing
filename=[# 001 bronze training form.wpd],priorfilename=[!finallo.bmp]
NOT printing
rather simple unequal compare.
I have a text file, the starting portion of which appears below. The
fir field is a filename followed by a tab and the second field is a
full path
I simply wish to print the filename if/when it changes from the
previous record processed.
I've also printed some fields and logic results for debugging
purposes. The output of the debugging also appears below and of
course my code loop is there as well.
Can some of you please look at my unequal compare statement to help me
determine why it is NOT detecting a difference in MOST of the records?
Thanks
input file snippet
-------------------
- dsl line only service agreement 1.15.02.pdf C:\Documents and
Settings\bobm3\My Documents\My Files\pdf\
-Release Notes-.rtf C:\Documents and Settings\bobm3\My
Documents\My PaperPort Documents\Samples\
4622XL.cfg C:\Documents and Settings\bobm3\My
Documents\Source\netopia\
!finallo.bmp C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.bmp C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.jpe C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.jpe C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
# 001 bronze training form.wpd C:\Documents and Settings\bobm3\My
Documents\My Files\training contract unit lists\
# 001 gold training form.wpd C:\Documents and Settings\bobm3\My
Documents\My Files\training contract unit lists\
code snippet
---------------
# Process Sequence File Listing File
while (<IFH>) {
chomp;
($filename, $path) = split /\t/;
print "filename=[$filename],priorfilename=[$priorfilename]\n";
# Determine if filename should print
if ("$filename" != "$priorfilename") {
print "printing filename\n";
$priorfilename = $filename;
$~ = "OFH_Filename";
write(OFH);
} else {
print "NOT printing\n";
}
# Now output path info
$~ = "OFH_Detail";
write(OFH);
}
debugging output snippet
------------------------------
filename=[- dsl line only service agreement
1.15.02.pdf],priorfilename=[]
NOT printing
filename=[-Release Notes-.rtf],priorfilename=[]
NOT printing
filename=[ 4622XL.cfg],priorfilename=[]
printing filename
filename=[!finallo.bmp],priorfilename=[ 4622XL.cfg]
printing filename
filename=[!finallo.bmp],priorfilename=[!finallo.bmp]
NOT printing
filename=[!finallo.jpe],priorfilename=[!finallo.bmp]
NOT printing
filename=[!finallo.jpe],priorfilename=[!finallo.bmp]
NOT printing
filename=[# 001 bronze training form.wpd],priorfilename=[!finallo.bmp]
NOT printing