slok has asked for the wisdom of the Perl Monks concerning the following question:
what I don't understand is why does pattern substitution for $string1 and $string2 does not gave me the end results of "geed feed" ?=== $default_str = "good food"; $string1 = $default_string; $string2 = $default_string; $string3 = $default_string; $string1 =~ s/o*/e/; print $string1; $string2 =~ s/o+/e/; $string3 = ~ s/o/e/g; print $string1; print $string2; print $string3; ====
Doesn't 1 and 2 look for "o".. and for 1, it has a "*", which means "match 0 or more", right?
and for 2, it has a "+", which means match 1 or more times, right?
thanks in advanced
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pattern Substitution..
by arturo (Vicar) on May 30, 2001 at 17:39 UTC | |
|
Re: Pattern Substitution..
by davorg (Chancellor) on May 30, 2001 at 17:50 UTC | |
|
Re: Pattern Substitution..
by Masem (Monsignor) on May 30, 2001 at 17:42 UTC | |
by japhy (Canon) on May 30, 2001 at 18:31 UTC | |
|
Re: Pattern Substitution..
by suaveant (Parson) on May 30, 2001 at 17:41 UTC | |
|
Re: Pattern Substitution..
by Big Willy (Scribe) on May 30, 2001 at 22:30 UTC | |
|
Re: Pattern Substitution..
by JP Sama (Hermit) on May 30, 2001 at 21:14 UTC |