in reply to Re: how to place rows information into column (2)
in thread how to place rows information into column?

wouldn't try to pattern match the scientific float... you could, but I think it's over-kill.

Do you really have any idea what does  /^(\S+)\s+(\S*)/o do?

/^(\S+)\s+(\S*)/o and print FH "K: ", $1, "V: ", $2, "\n" while <DATA> +;


where <DATA> contains over 22000 lines - less than a second
on my old (less than 1800 Mh cpu) home machine.

Replies are listed 'Best First'.
Re^3: how to place rows information into column (2)
by osunderdog (Deacon) on Feb 02, 2005 at 23:35 UTC
    /^(\S+)\s+(\S*)/o

    Matches one or more non-whitespace characters, followed by one or more whitespace characters, followed by 0 or more non-whitespace characters. The o indicates 'compile pattern only once'.

    from perldoc perlop

    If you want such a pattern to be compiled only once, add a "/o" after +the trailing delimiter. This avoids expensive run-time recompilation +s, and is useful when the value you are interpolating won’t change ov +er the life of the script.

    The parens capture those non-whitspace matches into variables $1 and $2 for use within the scope.


    "Look, Shiny Things!" is not a better business strategy than compatibility and reuse.