while (1) { ... } #### while (1) { say $1; } #### use strict; use warnings; use 5.012; if ('aXaYaZ' =~ /(a[XYZ])/ ) { say $1; } --output:-- aX #### my @matches = 'aXaYaZ' =~ /(a[XYZ])/g; say "@matches"; --output:-- aX
## while (1) { say $1; } ##
## use strict; use warnings; use 5.012; if ('aXaYaZ' =~ /(a[XYZ])/ ) { say $1; } --output:-- aX ##
## my @matches = 'aXaYaZ' =~ /(a[XYZ])/g; say "@matches"; --output:-- aX