my @nbdc_filehandles; my @nbdc_data; my $index=0; foreach my $file (@nbdc_files) { open my $fh, "<", "./$nbdc_dir/$file" or die "Can't open ./$nbdc_dir/$file"; $nbdc_filehandles[$index] = $fh; #get the first set of data values $_ = <$fh>; $_ = <$fh>; chomp; #get rid of trailing \n $nbdc_data[$index] = [ split(/\t/, $_) ]; # ... $index++; } # then sometime later, to reuse the stored filehandles my $fh = $nbdc_filehandles[$idx]; my $line = <$fh>; # ...