in reply to Still blurry on variables for filehandles

You can just open with an undefined scalar and use the scalar the same way you would the filehandle.

open my $foo, '<', 'data.txt' or die "Can't read data.txt: $!"; while ( <$foo> ) { chomp; #etc. } close $foo;

The resulting scalar can be passed around to other functions and used there.