Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Do you really need a deferred pattern there? I’d write it like so:

    qr/(?:$QUOTED|$NUM)(?(?{ '.' eq $+ })$FAIL)/;

    (which of course implies variables rather than constants.)

    Now given that, you get a zero-length match:

    $VAR1 = [
              'name => ',
              ', fav',
              '.num => ',

    So obviously a match against the lone dot was prevented, but $QUOTED succeeds in matching nothing.

    Okay then.

    qr/($QUOTED|$NUM)(?(?{ '.' eq $+ or not length( $+ ) })$FAIL)/;


    $VAR1 = [
              'name => ',
              ', fav.num => ',

    Well, I never. That’s what we wanted!