Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Can a regular expression include an arbitrary string variable?

by trippledubs (Deacon)
on Oct 17, 2019 at 02:49 UTC ( [id://11107575]=note: print w/replies, xml ) Need Help??


in reply to Can a regular expression include an arbitrary string variable?

#!/usr/bin/env perl my $string_to_find = 'hidden'; my @array_to_search = ('Foo', 'whathiddenever', 'Bar', '12hidden456'); my @matches = grep { /$string_to_find/ } @array_to_search; print "@matches";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found