http://qs321.pair.com?node_id=55847


in reply to strict

It's great you're using use strict and have warnings enabled; otherwise perl would never warn you about errors like this. The problem you're encountering is that when strict is enabled, perl requires that you declare your variables ($line and @lines, here) before using them. The simplest way is with the my keyword. Check out that link for more info. Other ways to declare variables include use vars and local, though my is the usual method for situations like yours. A quick fix might go like this:
#!/opt/perl5/bin/perl -w use strict; my ($line, @lines); while($line=<> and $line ne ".\n"){ push @lines,$line; } foreach(reverse @lines){ print; }

Replies are listed 'Best First'.
Re: Re: strict
by snowrider (Pilgrim) on Feb 02, 2001 at 01:49 UTC
    thanks for your help you just taught me that i can declare multiple variables at once. and that when you use strict you MUST declare your variables snowrider