Benchmark: running Regex, Substr, Unpack, each for at least 3 CPU seconds... Regex: 2 wallclock secs ( 3.17 usr + 0.00 sys = 3.17 CPU) @ 42172.56/s (n=133687) Substr: 2 wallclock secs ( 3.12 usr + 0.00 sys = 3.12 CPU) @ 56391.35/s (n=175941) Unpack: 2 wallclock secs ( 3.16 usr + 0.00 sys = 3.16 CPU) @ 61831.65/s (n=195388) #### #!/usr/bin/perl -w use strict; use Benchmark; my $input = 'X' x 65; #test input my @result; timethese(0, { 'Regex' => sub { undef @result; @result = ($input =~ /(.{16})(.{20})(.{20})(.{1})(.{8})/); # print join "\t", @result; }, 'Unpack' => sub { undef @result; @result = unpack "A16A20A20AA8",$input; # print join "\t", @result; }, 'Substr' => sub { undef @result; @result=((substr $input,0,15), (substr $input,15,20), (substr $input,35,20), (substr $input,55,1), (substr $input,56,8)); # print join "\t", @result; }, });