Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: filehandle for close

by eyepopslikeamosquito (Chancellor)
on Jan 14, 2013 at 21:05 UTC ( #1013279=note: print w/ replies, xml ) Need Help??

in reply to filehandle for close

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

Comment on Re: filehandle for close
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013279]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2015-10-06 19:53 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (160 votes), past polls