Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

(dkubb) Re: (2) Opening multiple filehandlers

by dkubb (Deacon)
on Apr 06, 2001 at 13:22 UTC ( [id://70439]=note: print w/replies, xml ) Need Help??


in reply to Opening multiple filehandlers

As an alternative to btrott's example using Symbol to create file handle references, you can also use IO::File to help you create n filehandles and push them onto an array:

#!/usr/bin/perl -w use strict; use IO::File; my @file_handles; foreach my $number (0..100) { my $fh = IO::File->new("> $number.txt") or die "Could not open file $number.txt: $!"; push @file_handles, $fh; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-16 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found