develooper Front page | perl.beginners | Postings from April 2002

Re: Filehandles named with a variable

Thread Previous | Thread Next
Jenda Krynicky
April 2, 2002 15:35
Re: Filehandles named with a variable
Message ID:
From: Mr Hash <>

> $1 is the resultant of a regex match. It don't need to be around very
> long, because I build a hash of open filehandles (key = filehandle
> string, value = file) at the time I open the file.
> And no, I don't close 'em! exit() does just fine.

Something like:

use FileHandle;
foreach $file (@path_list) {
	my $FH = new FileHandle;
	open $FH, "< $file" or next;
	$files{$file} = $FH;


my $FH = $files{$name};
$next_line = <$FH>;



=========== == ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
					--- me

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About