Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • This one is definitely going in the toolbox. Thanks!

    -sam

  • s/([\.\(\)\^\$\@\[\]\*\?\+\{\}\#\\])/\\$1/g;

    Is there a difference from $_ = quotemeta $_;?

    • I think quotemeta is a bit more verbose. Like it seems to quote everything that's not \w.
      • Ah, yes. Actually I just remembered that quotemeta is in fact problematic for this purpose because backslashes are not treated the same in regex quoting context vs double-quote quoting context. Which annoyed me when I was trying to interpolate user data in a the s/// pattern in a string to be evaled.