for ( values %main:: ) {
my $io = *{$_}{IO} or next;
my $name = *{$_}{NAME};
if ( defined fileno $io ) {
printf "fileno of %6s is %d\n", $name, fileno $io;
}
else {
print "($name is a virtual handle)\n";
}
}
####
fileno of stdin is 0
fileno of stdout is 1
fileno of STDIN is 0
fileno of STDOUT is 1
fileno of stderr is 2
fileno of STDERR is 2
(ARGV is a virtual handle)
##
##
fileno of STDERR is 2
fileno of STDIN is 0
fileno of STDOUT is 1
fileno of stdout is 1
fileno of stdin is 0
(ARGV is a virtual handle)
fileno of DATA is 3
fileno of stderr is 2