in reply to Re^3: Inexplicable uninitialized value when using (?{...}) regexp construct.
in thread Inexplicable uninitialized value when using (?{...}) regexp construct.

Does this sound reasonable?

perlre

Inside the (?{...}) block, $_ refers to the string the regular express +ion is matching against. You can also use pos() to know what is the c +urrent position of matching withing this string. + Currently, lexical (my) variables within a (?{...}) block can be + problematic, as their use may lead to the unintentional creation of + a lexical closure. For that reason it is usually advisable to + use globals in (?{...}) blocks. The code is properly scoped in the following sense: If the assertion i +s backtracked (compare "Backtracking"), all changes introduced after +localization are undone, so that

Dave

  • Comment on Re^4: Inexplicable uninitialized value when using (?{...}) regexp construct.
  • Download Code

Replies are listed 'Best First'.
Re^5: Inexplicable uninitialized value when using (?{...}) regexp construct.
by BrowserUk (Patriarch) on Sep 29, 2004 at 01:36 UTC

    Makes sense to me, but the guys on p5p will have better critique. I think I might make the last bit:

    + use (preferably localised) globals in (?{...}) blocks.

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon