#!/usr/bin/perl -w use strict; use Benchmark; my $input = 'X' x 65; #test input my @result; timethese(-10, { 'Regex' => sub { @result = ($input =~ /(.{16})(.{20})(.{20})(.{1})(.{8})/); # print join "\t", @result; }, 'Unpack' => sub { @result = unpack "A16A20A20AA8",$input; # print join "\t", @result; }, });