Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^7: Naming file handles with variables?

by QM (Vicar)
on May 04, 2009 at 20:44 UTC ( #761800=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Naming file handles with variables?
in thread Naming file handles with variables?

I like the map idea, though I'd probably end up with a subroutine. Here's what I find myself doing:

sub open_for_write { my @filenames = @_; my @fh; # or my %fh; for my $fn (@filenames) { my $fh; # does it exist? # is it zipped? # open for append? # open with create? $fh[@fh] = $fh; # wink, wink # or $fh{$fn} = $fh; } return @fh; # or return \%fh; ############ my @filehandles = open_for_write( @filenames ); # or my $filehandles_hashref = open_for_write( @filenames );

-QM
--
Quantum Mechanics: The dreams stuff is made of


Comment on Re^7: Naming file handles with variables?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://761800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-09-18 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (111 votes), past polls