in reply to Re: How do I assign a variable to the file content?
in thread How do I assign a variable to the file content?

A couple of notes:

print( <COUNTTHIS> );
prints the entire contents of the open file since <> in an array context reads all remaining lines.

print (<COUNTTHIS>); $thenumber = $_;
The first line above doesn't set $_ like while(<COUNTTHIS>) does. So the second line doesn't leave $thenumber set properly.

$thenumber = <COUNTTHIS>; print $thenumber;
This version fixes all of these problems.

        - tye (but my friends call me "Tye")