Help for this page
my @output = $x=~/(^A|^B)(.+)$/mg; print Dumper(\@output); # $VAR1 = ['A', ' data for A', 'B', ' data for b', 'A', ' data for A', + ...
while ( $x =~ m{^ (?<name>A|B) (?<data>.+) $}xmg ) { print "$+{name} method1 $+{data}\n" }