in reply to Re: Side effect of using undefined variable in regex (updated)
in thread Side effect of using undefined variable in regex

Thanks

This behaviour corresponds exactly to what I experience in my further reduced script:

use v5.30.0; 'ABC' =~ /B/ if @ARGV; my $last; say ' (\'NAME\'=~/$last/i)=', 'NAME' =~ /$last/i ? 1 : 0;

Output when called without arguments:

D:\>surprise.pl ('NAME'=~/$last/i)=1

Output when called with arguments:

D:\>surprise.pl all ('NAME'=~/$last/i)=0