Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Use function as a regex

by tybalt89 (Monsignor)
on Feb 15, 2018 at 16:34 UTC ( [id://1209233]=note: print w/replies, xml ) Need Help??


in reply to Use function as a regex

my @results = $str =~ /@{[ Re::re() ]}/g;

Replies are listed 'Best First'.
Re^2: Use function as a regex
by stevieb (Canon) on Feb 15, 2018 at 16:36 UTC

    Heh, that's quite slick, thanks! :)

    Might I ask where you found that tidbit? I swear I read the docs, so I must have overlooked that somewhere. I'd like to get an understanding of how and why that works properly.

      I don't think you'll find it as is in the doc. It's a side effect of the "@{ REF }" interpolation where REF can actually be an arbitrary expression, so it can be an anonymous array ref that only contains the one element you want. It's known as a secret operator.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-19 05:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found