#/usr/bin/perl -w use strict; local (*E,*F,*G); my $string = < *E, F=> *F, G=> *G); open $rh{$_}, ">test_$_.txt" or die $! for keys %rh; print { $rh{$_}} $_.$string for keys %rh; #### close $_ or die $! for keys %rh; #### close $rh{$_} or die $! for keys %rh; #error: # Bad file descriptor at C:\Perl\scripts\test5.pl line 20.