>>>>> "DR" == Demian Riccardi <demianricca...@gmail.com> writes:

  >> is the file well defined with white space separation? is the third field
  >> always the last field of non-whitespace?  is the value of the third
  >> field always 0 to start? is it always replaced by its line number? if
  >> those are all yes, then you can do this and it will blow away your
  >> example in speed (untested):
  >> 

  DR> Thanks for your response. I apologize for not being clearer.  I have a
  DR> three-column file that describes a bunch of parameters:

it is always important to be clear in problem specifications. your
numbers in the example were just row numbers which didn't mean anything.

  DR> TYPE1  NAME1  VALUE1
  DR> TYPE 1 NAME2  VALUE2
  DR> ....

  DR> The first two are identifying strings that never change values.  The
  DR> values are floating numbers.  This file is read in by an external
  DR> program that does some parameter dependent crunching.  For each
  DR> iteration, while I only vary the values I write the whole file.  My
  DR> thought was that if I could some how tie the array of values to the
  DR> file column, I could both avoid opening and closing the file and
  DR> perhaps shave off a bit of time.  I'll give File::Slurp a try with
  DR> some benchmarking.

you need to specify where and how those numbers are brought into this
program. if they are an array of values you can do it one way. if they
are derived based on other data in the row you can do another. not
knowing means i can't improve it for you.

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