mabman2 has asked for the wisdom of the Perl Monks concerning the following question:
From the "print" statements I inserted for troubleshooting purposes, it appears that the loop itself is in fact processing all the lines in the text file itself (which doesn't end on any special characters or anything, just a newline), and then goes mumble.
I'm not sure what's going on here, as for the most part I've been following various tutorials and the Camel Book when necessary.
I'm using ActiveState's build of v5.8.6 on Windows 2000 Pro, SP4.
Code is below; thanks for all suggestions - hopefully it's just something small I've overlooked.
open( BEST, "< $best_file") || die "Sorry, can't open $best_file: $!"; @best_array = (); @NewRow = (); while( <BEST> ) { print STDOUT "\t Reading next line...\n"; $Record = $_; chomp($Record); $Record =~ s/^\s+//; @NewRow = split(/\s+/, $Record); print STDOUT @NewRow[0], " ", @NewRow[1], "\n"; push( @best_array, [@NewRow] ); print STDOUT "\t Proceeding to next line...\n"; } print STDOUT "Processing BEST for duplicates"; ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: while loop not exiting?
by RazorbladeBidet (Friar) on Apr 06, 2005 at 18:05 UTC | |
by ikegami (Patriarch) on Apr 06, 2005 at 18:21 UTC | |
by mabman2 (Novice) on Apr 06, 2005 at 18:55 UTC | |
|
Re: while loop not exiting?
by polettix (Vicar) on Apr 06, 2005 at 18:46 UTC | |
|
Re: while loop not exiting?
by cog (Parson) on Apr 06, 2005 at 18:05 UTC |