Rashmun has asked for the wisdom of the Perl Monks concerning the following question:
Now @triplets contains the elements: atc cat ccc ttt aat But suppose i omit the global (g) qualifier/modifier:$string = "atccatccctttaat"; @triplets0 = $line =~ /(...)/g;
Now, I was expecting @triplets to consist of one element containing atc, but in fact it consists of one element containing 1. Could some kindly monk please explain why this is the case. -Rashmun$string = "atccatccctttaat"; @triplets0 = $line=~ /(...)/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex question
by izut (Chaplain) on Feb 07, 2006 at 12:39 UTC | |
by Rashmun (Initiate) on Feb 07, 2006 at 12:48 UTC | |
by mickeyn (Priest) on Feb 07, 2006 at 13:02 UTC | |
|
Re: regex question
by xdg (Monsignor) on Feb 07, 2006 at 12:33 UTC | |
|
Re: regex question
by ikegami (Patriarch) on Feb 07, 2006 at 15:02 UTC | |
|
Re: regex question
by robsv (Curate) on Feb 07, 2006 at 16:08 UTC | |
|
Re: regex question
by wulvrine (Friar) on Feb 07, 2006 at 12:48 UTC | |
|
Re: regex question
by GrandFather (Saint) on Feb 07, 2006 at 19:24 UTC |