Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The result is: It is not match! Why? How can I find whether keyword is inside a string or not? Thanks!!#!/usr/bin/perl use strict; my $keyword = 'Three-element literal'; my $string = 'The fred array gets a Three-element literal'; if ($keyword =~ substr ($string, 0, length $keyword)){ print "it is match!\n"; }else { print "it is not match!\n"; } exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: match problem
by Limbic~Region (Chancellor) on Apr 27, 2003 at 21:47 UTC | |
|
Re: match problem
by jasonk (Parson) on Apr 27, 2003 at 21:33 UTC | |
|
Re: match problem
by Cody Pendant (Prior) on Apr 27, 2003 at 21:48 UTC |