Richard Proctor wrote:
>
>I think what is needed is something along the line of :
>
>       $re = qz{ '(' \$re ')'
>                | \$re \$re
>                | [^()]+
>               };
>               
>Where qz is some hypothetical new quoting syntax

Well, we currently have qr{}, and ??{} does something like your \$re.

Warning: radical ideas ahead.

What would be useful, would be to leave REs the hell alone; they're 
great as-is, and are only getting hairier and hairier. What would be
useful, would be to create a new non-regular pattern-matching/parsing
"language" within Perl, that combines the best of Perl REs, lex, 
SNOBOL, Icon, state machines, and what have you. 

    $string =~ qz<<PARSE_THE_HELL_OUT_OF_THIS;
        ^(\d+) => $start_num        F:No_Num    # Start with a number
        -(\d|) => $end_num          F:One_Num   # Look for an end num
        {$start_num > $end_num?}    S:Got_Range # comparison
        
No_Num: (\$\w+) => $start_var       S:Its_A_Var
        exit (status=error yada yada)
        
One_Num: etc etc

PARSE_THE_HELL_OUT_OF_THIS

This new sub-language would, like SNOBOL, allow you to piece together
patterns into powerful expressions, would be more readable than Perl's
line-noise expressions (which are only getting worse with (?this) and
(?that)!), would allow recursive processing, maybe even looping.

Now _that_ would rule :-)

 ----------------------------------------------------------------------
 Eric J. Roode,  [EMAIL PROTECTED]           print  scalar  reverse  sort
 Senior Software Engineer                'tona ', 'reh', 'ekca', 'lre',
 Myxa Corporation                        '.r', 'h ', 'uj', 'p ', 'ts';

Reply via email to