| Paul Lalli 2006-10-30, 7:03 pm |
| Paul Lalli wrote:
> Goksie wrote:
>
>
> This is the one and only downside of using lexical filehandles I've
> ever found. You can't use the default that print() prints $_ if not
> given an argument. You have to state it explicitly:
>
> while (<$fh> ) {
> print $fh $_;
> }
>
> Those extra two characters of typing are well worth the benefits,
> however.
Ignore everything I just said - I read your code too quickly and didn't
parse it correctly in my head. And my answer is nonsensical. So my
apologies.
What exactly are you *trying* to do? You've opened a file for reading,
and then you're printing the value of that filehandle. Are you trying
to print the line read from the filehandle?
while (<$fh> ){
print;
}
or are you trying to print some other content *to* the filehandle? In
that case, you'd need to open the file for *writing* and find some
other source for the content.
Paul Lalli
|