periapt has asked for the wisdom of the Perl Monks concerning the following question:
However, when I do it this way, it works as expected.my $cfg = {}; open (INFILE,"<testfile.txt") || die "Could not open file\n$!\n"; $$cfg{infile} = \*INFILE; while(<$$cfg{infile}>){ print "$_\n"; } __END__ GLOB(0x20eab18)
I figure that the angle operator is not dereferencing $$cfg{infile} as I want but I cannot come up with a combinations of parens, curly braces and arrows that will make this work. What am I missing?my $cfg = {}; open (INFILE,"<testfile.txt") || die "Could not open file\n$!\n"; $$cfg{infile} = \*INFILE; my $infh = $$cfg{infile}; while(<$infh}>){ print "$_\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Indirect Referencing
by Roy Johnson (Monsignor) on Jun 17, 2004 at 14:02 UTC | |
by periapt (Hermit) on Jun 17, 2004 at 14:35 UTC | |
by Aragorn (Curate) on Jun 17, 2004 at 20:50 UTC | |
|
Re: Indirect Referencing
by demerphq (Chancellor) on Jun 18, 2004 at 18:35 UTC | |
by periapt (Hermit) on Jun 21, 2004 at 12:59 UTC |