#!/usr/bin/perl use strict; use warnings; sub openHandle { opendir my $dir,'.' or die "Could not opendir: $!"; return $dir; } my @a; while (1) { push @a,openHandle(); print "Handles in use: ",0+@a,"\n"; }