Help for this page

Select Code to Download


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