in reply to Splitting a String into n-character parts, without using a regex
Neither of these is significantly better than using a regex, though.#!/usr/local/bin/perl -l -w use strict; my $str = "aabbcc"; my @arr = unpack("A2" x (length($str)/2), $str); # Or marginally better #my @arr = unpack("A2" x (length($str) >> 1), $str); print for @arr;
|
|---|