Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: making regex case insensitive

by marinersk (Chaplain)
on Jul 16, 2013 at 15:41 UTC ( #1044628=note: print w/ replies, xml ) Need Help??


in reply to making regex case insensitive

Both preceding answers are excellent; one tells you how to find the answer, the other shows it to you.

I would add that if you are manually processing each element of the array, you may be doing it the hard way:

#!/usr/bin/perl # testgreparray.pl - Check behavior of grep on arrays use strict; my @cmdrsp = ( 'This is a test.', 'A booger a day keeps the doctor at bay.', 'Blimey, laddy, it\'s a booger!' ); if (grep(/booger/, @cmdrsp)) { print "Found it the easy way\n"; } my @searsp = grep(/booger/, @cmdrsp); my $seacnt = @searsp; if ($seacnt) { print "Found it the hard way\n"; }


Comment on Re: making regex case insensitive
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-12-26 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls