On Wed, 27 Jun 2001, Brett W. McCoy wrote:

> But you can't say $file = "CHR1", beacuse then you are creating a symbolic
> reference to a filehandle.  Very bad.  Do this instead:
>
> $file = *CHR1;
>
> Then you can properly use your filehandle.  What you really want to do is
> create an array of open filehandles (going by the code you had) and then
> do:
>
> print $file[$_] "stuff";

Oops, I'm thinking ahead of myself.  You will need to enclose the
filehandle in a block if you use an array:

print { $file[$_] } "stuff";

or you can store the filehandle in a variable:

my $fh = $file[$_];
print $fh "stuff";

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
He who has the courage to laugh is almost as much a master of the world
as he who is ready to die.
                -- Giacomo Leopardi

Reply via email to