$ alias perle
alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -E'
####
$ perle 'my $x = "1 12 123"; while ($x =~ /(?\d+)/g) { say $+{w} }'
1
12
123
$ perle 'my $x = "1 12 123"; while ($x =~ /(\d+)/g) { say $1 }'
1
12
123
####
$ perle 'my $x = "1 12 123"; while ($x =~ /^(\d+)/g) { say $1 }'
1
$ perle 'my $x = "1 12 123"; while ($x =~ /(\d+)$/g) { say $1 }'
123
$ perle 'my $x = "1 12 123"; while ($x =~ /^(\d+)$/g) { say $1 }'
$
####
$ perle 'my $x = "123"; $x =~ /(1)/; say $1'
1
$ perle 'my $x = "123"; $x =~ /(1)/; say $1 if $x =~ /2/'
Use of uninitialized value $1 in say at -e line 1.
$ perle 'my $x = "123"; $x =~ /(1)/; my $y = $1; say $y'
1
$ perle 'my $x = "123"; $x =~ /(1)/; my $y = $1; say $y if $x =~ /2/'
1
####
$ perle 'my $x = "1 12 123"; while ($x =~ /(\d+)\s*/g) { say $1 }'
1
12
123
$ perle 'my $x = "1_12_123"; while ($x =~ /(\d+)\s*/g) { say $1 }'
1
12
123
$ perle 'my $x = "1_12_123"; while ($x =~ /(\d+)/g) { say $1 }'
1
12
123
####
print "Weight:\n" unless $x=~/Gkg\./g;
####
$ perle '
my $x = "AB";
my $c = 0;
$x =~ /A/g;
while ($x =~ /\GB/) {
++$c;
last if $c > 1000;
}
say $c;
'
1001
####
$ perle '
my $x = "AB";
my $c = 0;
$x =~ /A/g;
while ($x =~ /\GB/g) {
++$c;
last if $c > 1000;
}
say $c;
'
1