|
|
| XP is just a number | |
| PerlMonks |
Re^4: What's the deal with apostrophes?by dsheroh (Priest) |
Log inCreate a new userThe Monastery GatesSuper Search Seekers of Perl WisdomMeditationsPerlMonks Discussion ObfuscationReviewsCool Uses For PerlPerl NewsQ&ATutorials PoetryRecent ThreadsNewest NodesDonateWhat's New |
| on Jun 10, 2009 at 11:26 UTC ( #770295=note: print w/ replies, xml ) | Need Help?? |
|
in reply to Re^3: What's the deal with apostrophes? It seems a little odd to me to just change characters for something like that and expect perl to "know" that's what they are there for. Does it really work that way? Yes, it does really work that way... more or less. The one catch is that, when you use alternate delimiters, you have to explicitly use either "m" or "s" at the beginning of the regex. The "m" and "s" are the actual operators which (in the right context) trigger a regex operation, so when perl sees those followed by punctuation, it recognizes that the punctuation used will be the delimiter for that regex without needing to expicitly set or reset anything. So, for example, all of these variations are equivalent: The print on each regex displays the number of matches found along with the delimiters used:
|
|
||||