Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to do the following. I have 2 variables
eg. $line='123: ABC/1.0/VAL [111:222:333:444]';
and $cont='ABC/1.0/VAL [111:222:333:444]';
And I have written the following in order to merely identify that the contents of $cont are contained with the contents of $line
But I keep getting a no match message and can't understand why. I'd really appreciate a response asap as this is seriously holding my work upif ($head=~/$cont/) { print "We have a match\n"; } else { print "No match\n"; }
update (broquaint): added <code> tags and formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Find a string within a string
by mce (Curate) on Nov 13, 2002 at 12:37 UTC | |
|
Re: Find a string within a string
by Chady (Priest) on Nov 13, 2002 at 11:51 UTC | |
|
Re: Correction to 1st -Find a string within a string
by Anonymous Monk on Nov 13, 2002 at 12:02 UTC | |
by rasta (Hermit) on Nov 13, 2002 at 12:11 UTC | |
by rdfield (Priest) on Nov 13, 2002 at 13:00 UTC | |
|
[TIMTOWTDI] Re: Find a string within a string
by Zaxo (Archbishop) on Nov 13, 2002 at 20:59 UTC |