[boulder.pm] hash for multiple filehandles?
Robert L. Harris
Robert.L.Harris at rnd-consulting.com
Wed Jul 19 15:35:05 CDT 2000
$i was instead of $RecNum, becuase I'm doing a "foreach $i (keys(%RecNum))
in there to hit all the Records to open.
Changed a few things to line them up with the man page and now I
have this:
my (%Handle);
my ($FileHandle)=Symbol::gensym();
.
.
.
foreach $i (keys(%Records)) {
$Handle{$i}="OUT"."$i";
$FileHandle=$Handle{$i};
open($FileHandle, ">$Out.$i") || die "Can't open Outputfile $Out.$i :$!:\n";
}
and I get this error when I enable use strict:
Can't use string ("OUT01") as a symbol ref while "strict refs" in use at
./DefMungeSplit.pl line 189 (#1)
(F) Only hard references are allowed by "strict refs". Symbolic references
are disallowed. See perlref.
Uncaught exception from user code:
Can't use string ("OUT01") as a symbol ref while "strict refs" in use at ./DefMungeSplit.pl line 189.
main::OpenOutput called at ./DefMungeSplit.pl line 150
Robert
Thus spake Rob Nagler (nagler at bivio.com):
> > What "print" doc? perldoc print? I'll check that when I get home.
> > For some ungodly reason, they refuse to let me put the perldoc, manpages, etc
> > on the boxes here.
>
> Don't need to install if you have the web:
>
> http://www.perl.com/pub/doc/manual/html/pod/perlfunc/print.html
>
> > print { $Handle{$i} } "$Line\n" if ($Records{$RecNum} eq "T");
> > Use of uninitialized value at ./DefMungeSplit.pl line 222 (#2)
> > Can't use an undefined value as a symbol reference at ./DefMungeSplit.pl line
> > 222 (#3)
>
> Is it the $i instead of $RecNum?
>
> If you use -w and "use strict", perl will tell you that "$i" is not a declared
> variable.
>
> Perl SHOULD tell you what undefined value (variable) is causing the error,
> but it doesn't, unfortunately.
>
> Rob
:wq!
---------------------------------------------------------------------------
Robert L. Harris | Micros~1 :
Senior System Engineer | For when quality, reliability
at RnD Consulting | and security just aren't
\_ that important!
DISCLAIMER:
These are MY OPINIONS ALONE. I speak for no-one else.
FYI:
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
More information about the Boulder-pm
mailing list