You need to lose the braces around the argument to close because Perl is interpreting that as an anonymous hash (as "use warnings" will tell you). This works for me:
use strict; use warnings; my %files; open $files{"foo"}, '>', "xyz" or die "open failed: $!"; print { $files{"foo"} } "done\n" or die "print failed: $!"; # close { $files{"foo"} }; # oops: 'Odd number of elements in anony +mous hash' close $files{"foo"}; # works ok
In reply to Re: filehandle for close
by eyepopslikeamosquito
in thread filehandle for close
by zbest
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |