mr. jaggers has asked for the wisdom of the Perl Monks concerning the following question:
I do some stuff for a while, and then at the end I want to close these filehandles.$VAR1 = { 'fn' => 'test3.dat', 'no' => [ '0', '1', '2', '3' ], 'fh' => bless( \*Symbol::GEN2, 'IO::File' ), 'oo' => [ '1', '2', '4', '8' ] };
So, I run the script and perl says:foreach (@files) { $_{fh}->close; }
So, I replace the block with a print Dumper($_{fh}); which then claims that the value is 'undef'.Can't call method "close" on an undefined value at test.pl line 62.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filehandle in hash value gets lost
by batkins (Chaplain) on Dec 20, 2002 at 02:37 UTC | |
by mr. jaggers (Sexton) on Dec 20, 2002 at 02:48 UTC | |
by Ionizor (Pilgrim) on Dec 20, 2002 at 02:51 UTC | |
by mr. jaggers (Sexton) on Dec 20, 2002 at 02:53 UTC | |
by Ionizor (Pilgrim) on Dec 20, 2002 at 02:56 UTC | |
by jdporter (Paladin) on Dec 20, 2002 at 14:08 UTC | |
by Ionizor (Pilgrim) on Dec 20, 2002 at 15:00 UTC | |
by batkins (Chaplain) on Dec 20, 2002 at 02:50 UTC |