Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re: fast string parser: regex versus substr

by bart (Canon)
on Nov 20, 2003 at 22:24 UTC ( [id://308734]=note: print w/replies, xml ) Need Help??


in reply to Re: fast string parser: regex versus substr
in thread fast string parser: regex versus substr

my ($jcpu,$j,$s)=(unpack('@2A16A40A232A16', $line))[0,1,3];
I think you'd be better off using the "x" template to ignore the third field (with index 2):
my ($jcpu,$j,$s)= unpack('@2A16A40x232A16', $line);

You can replace the leading '@2' with 'x2'', too. Or, just the reverse, replace the 'x232' with '@290'. I don't think it'll make much difference speedwise.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-26 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found