in reply to Unexpected matching results

Looks like consequences of dynamic scoping, see Perl::Critic::Policy::ValuesAndExpressions::UndefinedBehaviourMaybeQuoteit / $1 not quoted (value not frozen) undefined behaviour and quote the match vars

  • Comment on Re: Unexpected matching results (dynamic scope "$1")

Replies are listed 'Best First'.
Re^2: Unexpected matching results (dynamic scope "$1")
by hdb (Monsignor) on Sep 06, 2013 at 07:50 UTC

    Thanks a lot! If I change my code to

    'cause' => (/CAUSE (\S+)/ ?"$1":'UNDEF'), 'effect' => (/AFFECT (\S+)/?"$1":'UNDEF'),

    it works as expected.