in reply to Re^2: Regex (?{ code }) and use re 'eval'
in thread Regex (?{ code }) and use re 'eval'

I won't claim to clearly understand what you are doing but it looks like using (?{...}) is an overly complex way to go here. Something much simpler might work for you:

s/(...)/ func( $1 ) || $1 /ge; s/(\[(...)\])/ func( $2 ) || $1 /ge; s/(\[(...)\])/ my $ret= func( $2 ); defined $ret ? "[$ret]" : $1 /ge; s/(\[(...)\])/ my @ret= func( $2 ); @ret ? "[@ret]" : $1; /ge;

- tye        

Replies are listed 'Best First'.
Re^4: Regex (?{ code }) and use re 'eval' (KISS)
by SFLEX (Chaplain) on Nov 21, 2007 at 20:14 UTC
    Simple is better ^^
    I like the examles and will be playing with them.

    Thanks ^^