push @all_handles, $fh; #### my $fh = pop @all_handles; #### for my $fh (@all_handles) { ...; # do something with $fh } #### my $count_filehandles = @all_handles;