I came up with.
And it won the benchmark competition :-)sub dopack { foreach my $i ( 0..$#data ) { my $line=$data[$i]; my ($jcpu,$j,$s)=(unpack('@2A16A40A232A16', $line))[0,1,3]; warn "$jcpu $j $s"; # ..store the values in a hash, but that is not important here } }
I never really understood pack and unpack, but
it am getting to like it.
---------------------------
Dr. Mark Ceulemans
Senior Consultant
BMC, Belgium
In reply to Re: fast string parser: regex versus substr
by mce
in thread fast string parser: regex versus substr
by mce
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |