@parts=grep{$_}split(/(A.+?)(?=A|$)/,"A2ABA45"); $i=1; map {print $i++ . " -> $_\n"} @parts;