Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Dynamic regex assertions, capturing groups, and parsers: joy and terror

by japhy (Canon)
on Oct 03, 2005 at 14:59 UTC ( [id://496948]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # prints 'j'
    "japhy" =~ m{ (.) (?{ print $1 }) }x;
    ...
    # prints nothing (undef, specifically)
    $rx = qr{ (.) (??{ print $1 }) }x;
    "japhy" =~ m{ (??{ $rx }) }x;
    
  2. or download this
    use Data::Dumper;
    $Data::Dumper::Indent = 1;
    ...
      my $alt = pop @r;
      [ @r, { ALT => [ @{ $alt->{ALT} }, $w->{WORD} ] } ];
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://496948]
Approved by cristian
Front-paged by gmax
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-19 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found