in reply to where to declare a variable...

Redeclaration
Bit bucket claims old data
Never to return

Only declare once
Vanquish data entropy;
Your comment is right

However,

There must be another option.
Could you do this?

open FH, $file1 or $file2 or die $!; my @entries = <FH>; close FH;

Rob

Replies are listed 'Best First'.
Re: Re: where to declare a variable...
by rje (Deacon) on Dec 10, 2001 at 20:45 UTC
    Mea culpa.

    You can't say
    open FH, $file1 or $file2 or die "Rats!\n";
    Stick with the earlier poster's suggestion:

    $fh = $file1 || $file2; open FH, $fh or die $!; etc

    Sorry 'bout that.

    Rob