in reply to comment inside perl regular expression

With the /x modifier:
my $re = qr{ "[^"]*" # first quoted string = URL ... # more stuff }x

Replies are listed 'Best First'.
Re^2: comment inside perl regular expression
by JavaFan (Canon) on Mar 13, 2009 at 12:59 UTC
    Or by doing something really wacky:
    /(?:(*FAIL)\QThis is a comment\E)?PATTERN/
    Not something I recommend doing though.
      If you want inline comments, you can use (?# comment ) instead, which is less wacky, but I still think that it's no great thing in terms of readability.