oryann9 wrote:
Dr. Ruud wrote:
"Mumia W." schreef:
my $lang = ($topdir =~ /([^\/]+)$/)[0];
ITYRMSL:
my ($lang) = $topdir =~ m~([^/]+)$~;
I have never seen the expression m~ or $~
Will you tell me what this is and what is says?
Like all Perl quoted constructs, the pattern match
can take any delimiter you choose as long as you supply
the m explcitly, so the following are equivalent:
/regex/
m/regex/
m~regex~
m(regex)
m<regex>
(Note that bracket-like delimiters are paired.)
Using a different delimiter from the usual slash character
removes the need to escape slashes within the regex itself,
which is what Mumia has done.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/