in reply to Re^3: Generate the perl sequence 1, 11, 111, ....
in thread Generate the perl sequence 1, 11, 111, ....
Use the source, Luke.
regex prefix_circumfix_meta_operator:reduce (--> List_prefix) { $<s> = ( '[' [ | <op=infix> ']' ['«'|<?>] | <op=infix_prefix_meta_operator> ']' ['«'|<?>] | <op=infix_circumfix_meta_operator> ']' ['«'|<?>] | \\<op=infix> ']' ['«'|<?>] | \\<op=infix_prefix_meta_operator> ']' ['«'|<?>] | \\<op=infix_circumfix_meta_operator> ']' ['«'|<?>] ] ) <?before \s | '(' > ...
So [\ is really a handled specially.
Or if you're not inclined to read the source, you can examine the match tree:
The output in a terminal is coloured, and much better readable. Basically you see that [\ is matched as a prefix_circumfix_meta_operator with the op: ~$ cat test.t [\~] 1..3 $ perl5.10.0 STD5_dump_match test.t comp_unit: statementlist: statement: EXPR: left: pre: prefix_circumfix_meta_operator: [\ op: ~ ] noun: value: number: integer: 1 infix: .. right: noun: value: number: integer: 3 \n
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Generate the perl sequence 1, 11, 111, ....
by TimToady (Parson) on Oct 11, 2008 at 16:32 UTC | |
Re^5: Generate the perl sequence 1, 11, 111, ....
by blazar (Canon) on Oct 11, 2008 at 18:20 UTC | |
by moritz (Cardinal) on Oct 11, 2008 at 18:46 UTC |
In Section
Seekers of Perl Wisdom