|Pathologically Eclectic Rubbish Lister|
odd behavior with DATA sectionby Nkuvu (Priest)
|on Jul 22, 2005 at 23:36 UTC||Need Help??|
Nkuvu has asked for the wisdom of the Perl Monks concerning the following question:
I have a series of spreadsheets and a large directory structure to move them into. I have a list of the filenames for each sheet, along with the final residing directory. Rather than move these all manually, I decided to write a quick script to do this.
The script worked fine, and moved all of the files into the right directories (and created the directories if they didn't exist) but along the way I ran into some errors that I can't explain. Specifically, some null lines seem to have infested my DATA section...
After changing the names to protect the innocent, this is the script I'm using:
The script produces the following output:
Note that I can easily fix this behavior by uncommenting the next if not $line part. The question is not how to avoid this error, the question is why it's happening in the first place.
All of the lines are read, and I don't see anything in the script that would cause me to read another line. I don't recall seeing this sort of behavior before, but I do normally include the check against empty lines.
What simple thing am I overlooking here? I SuperSearched for "__DATA__ null" as well as "__DATA__ empty" with no promising results. I've spent too much time trying to diagnose this problem, though, so I'm throwing in the towel and asking for ideas or information.
(by the way, "This is perl, v5.8.7 built for MSWin32-x86-multi-thread")
Update: I don't see the same behavior on my Mac (running OS X 10.4.1). "This is perl, v5.8.6 built for darwin-thread-multi-2level" So I'm totally baffled.