- or download this
use strict;
use warnings;
...
print "RESULTS: " , Dumper(\@string_one_results), $/;
# RESULTS: $VAR1 = ['a','21','b','23'];
- or download this
my $string_two = 'foo bar [21a] plus (23b) baz bax';
my @string_two_results = $string_two =~ m{ (\d+) (a|b) }gx;
print "RESULTS: " , Dumper(\@string_two_results), $/;
# RESULTS: $VAR1 = ['21','a','23','b'];
- or download this
my $string_three = 'foo bar [21a] plus (b23) baz bax';
my @string_three_results = $string_three =~ m{ (\d+) (a|b) | (a|b) (\d
++) }gx;
print "RESULTS: " , Dumper(\@string_three_results), $/;
# RESULTS: $VAR1 = ['21','a',undef,undef,undef,undef,'b','23'];