Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Answer: How do I escape '#' pound sign?

by ariels (Curate)
on Feb 21, 2001 at 19:27 UTC ( #59939=categorized answer: print w/replies, xml ) Need Help??

Q&A > regular expressions > How do I escape '#' pound sign? - Answer contributed by ariels

Inside a regular expression (given the section we're in):
$x = '# a comment'; print "$&\n" if $x =~ m/^\#.* # A comment! /x;
(You have to backwhack the #, or m//x will consider it a comment.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2016-12-07 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (125 votes). Check out past polls.