#!/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; }