#!/usr/bin/env -S perl #use warnings; # suppress uninitialized warnings use strict; use feature qw{ say }; use experimental qw( signatures ); $_ = 'abXXXXacVVVVVad'; #$_ = 'abacad'; my $lim = 7; say "Examining \'$_\' $lim times"; say "/a(.)/"; if (/a(.)/g) { #say "/q(.)/"; # switch to see no-match example #if (/q(.)/g) { say "\$1: $1"; say "\$&: $&"; } else { say 'No match'; } for my $try (1 .. $lim) { say "//"; if (//g) { say "\$1: $1"; say "\$&: $&"; } else { say 'No match'; } } $_ = '37.5BBBBB98UUUUU4.075QQQQQ42TTTT0.357SSS'; $lim = 5; say "\nExamining \'$_\' $lim times"; say '/[^\d.](\d+(?:\.?\d*)?)/g'; if (/[^\d.](\d+(?:\.?\d*)?)/g) { say "\$1: $1"; say "\$&: $&"; } else { say 'No match'; } for my $try (1..$lim) { say "//"; if (//g) { say "\$1: $1"; say "\$&: $&"; } else { say 'No match'; } } exit(0); __END__