> #!/usr/bin/perlThat doesn't sound right to me. Scope doesn't change in a loop. All
> # this just re-implements tail -1
> #
> # usage:
> # /this/file < /some/text/file.txt
> #
>
> my $last;
>
> while( <> ) {
> $last = $_;
> }
>
> print $last;
> -----------------------------
>
> Now, try with the "my $last;" *inside* the while(). That last print
> line won't have a clue what $last is.
of this code is in the same scope, so the print statement will work
fine.