Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Failed match not stored

by duelafn (Parson)
on Apr 08, 2025 at 00:09 UTC ( [id://11164620]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11164620]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2026-02-14 03:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.