While cruising through the Perl source, I found this delightful line of code in toke.c, in the S_scan_str() function:
It blew my mind. What it does is find the matching delimiter for a q// string if the delimiter happens to be one of those specific characters.if (term && (tmps = strchr("([{< )]}> )]}>", term))) term = tmps[5];
Here's the quiz. First, how does it work? Second, why is )]}> repeated?
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Source Divers: string delimiters
by mojotoad (Monsignor) on Jul 24, 2002 at 19:40 UTC | |
by dcpve (Sexton) on Jul 24, 2002 at 19:50 UTC | |
by japhy (Canon) on Jul 24, 2002 at 19:53 UTC | |
by Aristotle (Chancellor) on Jul 25, 2002 at 20:43 UTC | |
Re: Source Divers: string delimiters
by jackdied (Monk) on Jul 24, 2002 at 19:34 UTC | |
Re: Source Divers: string delimiters
by Abigail-II (Bishop) on Jul 25, 2002 at 09:45 UTC | |
by japhy (Canon) on Jul 25, 2002 at 11:22 UTC | |
Re: Source Divers: string delimiters
by cybear (Monk) on Jul 25, 2002 at 12:06 UTC | |
Re: Source Divers: string delimiters
by PrakashK (Pilgrim) on Jul 26, 2002 at 20:29 UTC |
Back to
Meditations