my $str = "\001\002hello"; my @results = unpack 'C2 /A', $str; say "@results"; --output:-- 1 he