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.
  • The problem is that I apparently can't use a pattern with /g on a dereferenced scalar.

    You certainly can. I use this technique extensively in CAM::PDF to incrementally parse a PDF document into a DOM. I pass a scalar reference to the content from one sub to the next.

    Without delving too deep into your code, I believe the important bit that you are missing is the "c" flag on the regexp.
    • Well, I re-added my /g regexp (as noted in another comment) this morning, and it worked, even when matching against $$string. I did not add /c, though. I don't know what I did wrong yesterday!

      I didn't know about /c, though. It doesn't appear to be documented in perlre, although it's hard to search for one character things, sometimes. It does appear in perlreref.

      I'm glad to know about it, but it should not be an issue here: at no point should the regex fail and then need to match again.