in reply to Filehandle/array naming

try enclosing the filehandle in <>,

Edit: The above won't work because the inside to the diamond operator must be a simple scalar variable and ${fh.$FILE} is not (why?). See choroba's answer

 while ( ${line.$FILE} = <${fh.$FILE}> ) {

I must note that yours is definetely uncommon coding style! I usually use arrays rather than creating unqiue variables, one for each array item, whose name contains the array index. If I deciphered your code correctly that is.

EDIT: I forgot the tail -f, perhaps you want to replace that with a Perl module: File::Tail

bw, bliako

Replies are listed 'Best First'.
Re^2: Filehandle/array naming
by choroba (Cardinal) on Nov 20, 2020 at 11:38 UTC
    This won't work, unfotunately. See perlop:

    > If what's within the angle brackets is neither a filehandle nor a simple scalar variable containing a filehandle name, typeglob, or typeglob reference, it is interpreted as a filename pattern to be globbed, and either a list of filenames or the next filename in the list is returned, depending on context. This distinction is determined on syntactic grounds alone. That means <$x> is always a readline() from an indirect handle, but <$hash{key}> is always a glob(). That's because $x is a simple scalar variable, but $hash{key} is not--it's a hash element. Even <$x > (note the extra space) is treated as glob("$x "), not readline($x).

    So, use readline, not the diamond.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      A clarification is needed: if $x is a "simple scalar variable", then what is ${fh.$FILE}?

        A symbolic reference?

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Thx a Million Choroba, that solved it!!!!
Re^2: Filehandle/array naming
by JSAWS (Novice) on Nov 20, 2020 at 12:00 UTC
    Thx Bliako, I did have the <> in my code, not sure why it did not make it in my post. But that did not work either, readline was the golden ticket!