use Data::Dumper; my $var = "hallo"; $var =~ /(.)(..)(.)/ or die; my @array; for (1..$#+) { push @array, substr($var, $-[$_], $+[$_] - $-[$_]); } print Dumper \@array;