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;
In reply to Re: Splitting a String into n-character parts, without using a regex
by runrig
in thread Splitting a String into n-character parts, without using a regex
by leons
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |