On Thu, Aug 23, 2001 at 06:10:48PM -0500, [EMAIL PROTECTED] wrote:
> What is the best way in Perl to do the following?
Define best. Is it fastest? Most readable? Most clever?
> Check $string to see if the following path is found /this is right/
> If found anywhere in the string return 1, if not return 0. The whole
> pattern must be found just like written.
I'd either use:
index($string, "/this is right/") != -1
if I'm being frugal with CPU cycles, or
$string =~ m|/this is right/|
if I'm not, or if I prefer readability at that point.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]