And yes, I was sort of expecting unpack() to be faster, but it is still better to try it to be sure.
Indeed. I certainly didn't mean to suggest your benchmark test wasn't a splendid idea. I only meant that, in this case, the outcome of the benchmark test was consistent with one's rational expectation based on one's understanding of unpack() and its raison d'être. After all, the Perl FAQ states:
C:\>perldoc -q fixed | head -5
Found in C:\strawberry\perl\lib\perlfaq5.pod
How can I manipulate fixed-record-length files?
The most efficient way is using pack() and unpack(). This is faste
+r than
using substr() when taking many, many strings. It is slower for ju
+st a
few.
C:\>
Jim