Skip to content

Instantly share code, notes, and snippets.

@petdance
Created July 14, 2017 02:07
Show Gist options
  • Save petdance/0f1b9e37750cd443bc4bad4b467e7454 to your computer and use it in GitHub Desktop.
Save petdance/0f1b9e37750cd443bc4bad4b467e7454 to your computer and use it in GitHub Desktop.
Why does \Q not work here?
#!perl
use warnings;
use strict;
use 5.010;
use Data::Dumper;
my $re = '\Qfoo(';
warn Dumper( $re );
my $qr1 = qr/\Qfoo(/;
warn Dumper( $qr1 );
my $qr2 = qr/$re/;
warn Dumper( $qr2 );
[21:07:00] (SVN) turkey:~ $ perl foo
$VAR1 = '\\Qfoo(';
$VAR1 = qr/foo\(/;
Unmatched ( in regex; marked by <-- HERE in m/\Qfoo( <-- HERE / at foo line 15.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment