in reply to Reading Text File into Hash to Parse and Sort

Just some comments:

- Your data separator is apparently the pipe ("|") character. Why are you splitting on the tab ("\t") character?

When you do:

print <FILE>; #Prints entire file
this gets the file handler to the end of the file, so that the next line:
while (<FILE>){
will not get any line.

- You say #Date for the first field of @array, but I fail to see a date in your input data.

- If you are thinking of sorting data, then you probably don't want to use a hash, but rather an array.

What you are trying to do with your code is not entirely clear to me, but this might get you closer to what you want:

#!/usr/bin/perl use strict; use warnings; my $file_name = 'FB_LPWAP.txt'; open my $FILE, '<', $file_name or die "ERROR: Could not open file $!"; + # better syntax for opening a file # print <$FILE>; don't do that, you will get no data in the while loop while (<$FILE>){ my @array = split /\t/, $_; # with the data shown, you should spli +t on pipe or on a pattern such as /\|\s*/ print join "\t", @array, "\n"; } close ($FILE);
But as I said, your program does not seem to match the data you've shown. Also, it does not make much sense to split data on tabs and then to print the fields separated by a tab. There was really no need to split it in the first place (unless you wanted to split on pipes and separate the data with tabs, but, then, there would probably be easier ways to replace pipes by tabs, using regular expressions, for example).

Je suis Charlie.