Sent from my iPhone
On 11/12/2011, at 12:04 AM, Shlomi Fish <shlo...@shlomifish.org> wrote: > Hi, > > On Fri, 09 Dec 2011 20:44:18 +0000 > Rob Dixon <rob.di...@gmx.com> wrote: > >> On 09/12/2011 11:35, flebber wrote: >> With this program >> >> @data = <ARGV>; >> $sum += $_ for @data; >> print $sum / @data; >> > > This program: > > 1. Does not have "use strict;" and "use warnings;". > > 2. Collects all lines in one giant array (which is a waste of memory.). > > 3. Does not do exactly match the original program. > > It can and should be written better. > > All that put aside, I think it's possible that giving full programs as > answers to people's questions here may be detrimental to the process of > helping them, because they will just use that program, instead of learning > how to properly write the code themselves. > > Regards, > > Shlomi Fish > > -- > ----------------------------------------------------------------- > Shlomi Fish http://www.shlomifish.org/ > List of Portability Libraries - http://shlom.in/port-libs > > You can never truly appreciate The Gilmore Girls until you’ve watched it in > the original Klingon. > > Please reply to list if it's a mailing list post - http://shlom.in/reply . As an aside when playing with rob script I had to update it to use warnings and strict as I have them on by default. Rob had sort of answered the next thing I was thinking. What happened if I had to sum or average 10+ files. Sayth -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/