Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Speed of Split

by Corion (Patriarch)
on Nov 18, 2004 at 07:44 UTC ( [id://408708]=note: print w/replies, xml ) Need Help??


in reply to Speed of Split

These fields are "space delimited", but they also seem to be in a fixed column format, so a look at pack/unpack and their various parameters. This would save you the trip to the regex engine, at the price of some more parsing time spent in the number parser that has to skip the spaces now. You can maybe save more time by making @lines and @data live in a larger scope, and you can save time by not shelling out to the join program:

local @ARGV = ($file1, $file2, $file3, $file4); my (@lines) = <>; my (@data); for my $line (@lines) { @data = split /\s+/, $line; ... };

Replies are listed 'Best First'.
Re^2: Speed of Split
by ikegami (Patriarch) on Nov 18, 2004 at 07:53 UTC

    I think you're confusing join with cat

    $ cat a 1 a 2 A $ cat b 1 b 2 B $ join a b 1 a b 2 A B

    Your code would return:

    1 a 2 A 1 b 2 B

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://408708]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-20 13:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found