in reply to loop by line on a file
G'day sage.erosenin,
Welcome to the monastery.
Is "+<four_comma.txt" a valid filename on your OS? It is on mine. Any chance you inadvertently created "+<four_comma.txt" as part of earlier coding, testing, etc.? Check you don't have both "four_comma.txt" and "+<four_comma.txt". Using the three-argument form of open will ensure there's no confusion between mode and filename:
open my $fh, '+<', 'four_comma.txt' or die ...
The filename, "four_comma.txt", suggests (at least the possibility) that you've confused array elements with file records. Check your file contents don't look something like this:
record1,record2,record3,record4,record5
-- Ken
|
|---|