[boulder.pm] hash for multiple filehandles?
Rob Nagler
nagler at bivio.com
Wed Jul 19 13:38:55 CDT 2000
Couple of points...
The specific error is caused by the lack of braces (see "print" doc):
Note that if you're storing FILEHANDLES in an array or other
expression, you will have to use a block returning its value
instead:
print { $files[$i] } "stuff\n";
print { $OK ? STDOUT : STDERR } "stuff\n";
However, I don't understand how
if ($Handle{$RecNum} eq "T") {
print $Handle{$i} "$Line\n";
}
Will every be executed, because
$Handle{$i}="OUT"."$i";
Not sure what you want as the test case, but 'eq "T"' is probably not it.
You should always use "my" and "use strict" imiho, e.g.
foreach my $i (keys(%Records)) {
I'm not sure what the first part:
foreach my $i (keys(%Records)) {
$Handle{$i}="OUT"."$i";
open($Handle{$i}, ">$Out.$i") || die "Can't open Outputfile $Out.$i :$!:\n";
}
is doing, because you'll be overwriting the files in the second "foreach".
Perhaps this is just test code.
Hope this helps,
Rob
More information about the Boulder-pm
mailing list