in reply to Failed match not stored

Thus, you can fix the issue in a couple ways. Explicitly forcing scalar context:

use Test::More tests=>1; my @arry1 = (scalar 'string' =~ m/str/, 'second'); my @arry2 = (scalar 'string' =~ m/foo/, 'second'); is $arry2[1], $arry1[1];

or choosing your false value (and implicitly forcing scalar context)

use Test::More tests=>1; my @arry1 = (('string' =~ m/str/ or 0), 'second'); my @arry2 = (('string' =~ m/foo/ or 0), 'second'); is $arry2[1], $arry1[1];

Good Day,
    Dean

Replies are listed 'Best First'.
Re^2: Failed match not stored
by BillKSmith (Monsignor) on Apr 08, 2025 at 13:55 UTC
    I already had a 'workaround' similar to your second solution. I will adopt your first suggestion because it explicitly addresses the real issue rather than working around it.
    Bill