Brian wrote:

        foreach $line (<LOGFILE>) {
while (my $line = <$logfile>) would be a better idea than foreach $line.


Just curious for an explanation to this. I tend to use foreach too. Don't they 
both accomplish the same thing? :)


Yes, but they go about it in different ways. The foreach loads the entire file into memory and steps through it one line at a time. The while loads only one line at a time.


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to