Indirect Filehandles are discussed in perldoc perlopentut. The documentation for open may also be useful.
So your code should look like:
use strict; open(my $foo, "<data.txt"); while(<$foo>){ chomp; print "Saw $_ in data.txt\n"; } close $foo;
For hints on lexical variables, you might try "Coping with scoping"
In reply to Re: Still blurry on variables for filehandles
by bingos
in thread Still blurry on variables for filehandles
by throop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |