rsiedl has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my @myTerms = ( 'foo bar', 'blah' ); my $term = "foo"; if ( grep /\Q$term\E/, @myTerms) { # the line that i'm having trouble with - $match always = null. my ($match) = ( grep $term =~ /\Q$_\E/, @myTerms ); print "$term does match with $match\n"; } # end-if exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex to return matched value from array
by BrowserUk (Patriarch) on Sep 22, 2004 at 15:06 UTC | |
|
Re: regex to return matched value from array
by borisz (Canon) on Sep 22, 2004 at 15:06 UTC | |
|
Re: regex to return matched value from array
by JediWizard (Deacon) on Sep 22, 2004 at 15:08 UTC | |
by rsiedl (Friar) on Sep 22, 2004 at 15:10 UTC | |
|
Re: regex to return matched value from array
by zejames (Hermit) on Sep 22, 2004 at 15:14 UTC | |
|
Re: regex to return matched value from array
by pelagic (Priest) on Sep 22, 2004 at 15:09 UTC |