in reply to Only the last file data is getting saved in the hash

Try doing this:

my $grepped = grep(... print $grepped, "\n";

That will tell you if the data is being overridden or if you're just retrieving the same data each time.

You could also help yourself by tidying up your code (see perlstyle) so you can read it more easily.

Another thing you can do is choose better variable names: using $filename and $file_name is just asking for trouble.

-- Ken

Replies are listed 'Best First'.
Re^2: Only the last file data is getting saved in the hash
by Anonymous Monk on Nov 07, 2010 at 07:29 UTC
Re^2: Only the last file data is getting saved in the hash
by iphone (Beadle) on Nov 07, 2010 at 07:45 UTC

    cleaned up the code a bit.Data is getting overridden for sure