#!/usr/local/bin/perl #Why do you need this?!? #use Cwd qw(cdir); use IO::Dir; use IO::File; print "Please enter the name and location of the directory to parse:\n"; chomp(my $directory = ); my $dh = IO::Dir->new($directory) || die "Cannot open directory '$directory': $!\n"; my @filenames; push @filenames, $_ for map { "$directory/$_" } grep !/^\.\.?/, $dh->read; $dh->close; my %file_data; foreach my $filename (@filenames) { my @final_data; # Why do you need to do this?!? #chdir "./data"; my $fh = IO::File->new($file) || die "Cannot open file '$file': $!\n"; my $i = 0; while (<$fh>) { next while $i++ <= 14; push @{$file_data{$file}}, (split /\t/)[3]; } $fh->close; } # Now, at this point, you have a hash called %file_data # which is keyed by filename. Each filename points to an # array reference contained the values in the 4th column, # starting at the 15th line. What do you want to do with it?