BorgCopyeditor has asked for the wisdom of the Perl Monks concerning the following question:
use strict;
my (@dictionary,$query,$term);
@dictionary=('lo/gos','lo/gou','lo/gw|','lo/gon');
$query='lo/gou';
foreach $term (@dictionary) {if($query=~$term) {print "$term\n";}}
This yields:lo/gou lo/gw|which is not at all what I expected. If I invert $query and $term, only 'lo/gou' matches. Can someone help me understand what's going on here? BCE --"Your punctuation skills are insufficient!"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Am I on the pipe, or what?
by Zaxo (Archbishop) on Jul 09, 2002 at 23:15 UTC | |
by flounder99 (Friar) on Jul 10, 2002 at 04:40 UTC | |
|
Regex without 'm' or '/'
by dvergin (Monsignor) on Jul 10, 2002 at 01:30 UTC | |
by danger (Priest) on Jul 10, 2002 at 04:05 UTC | |
by hv (Prior) on Feb 24, 2003 at 01:19 UTC | |
by BorgCopyeditor (Friar) on Jul 10, 2002 at 02:03 UTC | |
|
Re: Am I on the pipe, or what?
by TexasTess (Beadle) on Jul 09, 2002 at 23:14 UTC |