in reply to Re: Re: What's the most efficient way to write out many lines of data?
in thread What's the most efficient way to write out many lines of data?

D'oh!

You'd think I'd at least look at the output file! I changed the regex line to

print OUTFILE join (",", /(.{1,10})/g), "\n"
and I got the results:
Creating file took 9.90625 seconds Splitting file using regexp took 12 seconds
a lot slower but nowhere near 16 minutes.

--

flounder

Replies are listed 'Best First'.
Re: Re: Re: Re: What's the most efficient way to write out many lines of data?
by hagen (Friar) on Jul 10, 2003 at 22:55 UTC
    Yup! That did it.

    However this is an idiom I'm not familiar with - I've only got the Camel's head here at work (Perl in a Nutshell) and the join entry doesn't expand on it. It's a great example of DWIM!

    With my use of the explicit split, as I said, the split file had lines like:-

    ,XXXXXXXXX,,XXXXXXXXXX,,XXXXXXXXXX,,...

    however, when I changed it to your use - even using my beginner's pattern of /(XXXXXXXXXX)/g - it DWIM'd!

    If you (or another brother) have time I'd appreciate an "expanded" Perl baby-talk explanation - i.e. put in all the bits that aren't necessary so we can see what's been left out.

    I (think I) understand the default $_ as being the input, but it's the use of a pattern to generate list context that's new to me.

    Thanks in advance

    hagen