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; }
In reply to (dkubb) Re: (2) Opening multiple filehandlers
by dkubb
in thread Opening multiple filehandlers
by leons
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |