>>>>> "SF" == Shlomi Fish <shlo...@iglu.org.il> writes:

  >> my @records;
  >> 
  >> my @lines = read_file( $filepath );
  >> 
  >> chomp @lines;
  >> 

  SF> You should read the file line-by-line, using:

  SF>   < $fh >

  SF> Not slurp it.

there is no reason to read it line by line. it is small enough to
slurp. slurping is faster and generally cleaner than line by
line. considering he was doing a poor version of slurping before, this
is much better.

  >> print @report ;

  SF> This map will consume a lot of memory, better do it using a foreach loop.

again, not. his file isn't that large. given he wants to print to stdout
and also a file, it is easier to build up the report one time and print
twice. simple and also faster.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
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