http://www.perlmonks.org?node_id=477463


in reply to odd behavior with DATA section

You really ought to be using __END__ instead of __DATA__. See the SelfLoader POD explanation of the way the __DATA__ is intended to be used.

Notice that the first warning is issued for the data produced from the second input record. The fact that next if not $line; allows you to avoid the warnings tells us that $line is an empty string (it could not be uninitialized, since this would terminate the while loop). This means that either the string stored in $/ is being read immediately after the end of the first input record, or that your perl build's IO is broken or confused by the record delimiters in the text. What is the value of the $/ variable?

For testing, on the line before your while() loop, insert the following assignment:

$/ = '|';

change the text after the __DATA__ token to (the data text should be on one line):

__DATA__ filename1:some/file/path|filename2:some/other/file/path|filename3:yet/ +another/file/path/oooh/this/one/is/long

and split with the pattern: /:/

If the warnings go away, I suspect there is a problem with your record delimiters (LF, CR/LF, etc.) or the default value of $/.