Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Using /m when $ is followed by punctuation

by ikegami (Pope)
on Aug 05, 2014 at 22:40 UTC ( #1096367=note: print w/ replies, xml ) Need Help??


in reply to Using /m when $ is followed by punctuation

Drop the useless $.

/ $ \n /xm
is the same as just
/ \n /xm


Comment on Re: Using /m when $ is followed by punctuation
Select or Download Code
Replies are listed 'Best First'.
Re^2: Using /m when $ is followed by punctuation
by jrw (Scribe) on Aug 05, 2014 at 22:46 UTC
    Thanks, I see that now. Do you know of an answer to the general question: how to get perl to parse $ followed by by an escape sequence as $ \whatever rather than $\ whatever?

      I don't think you'd ever need to do that, but I can think of a couple of solutions:

      • (?x: $ )
      • (?=\n|\z) (if /m is in effect)
      • (?=\n?\z) (if /m isn't in effect)
      • (?![^\n]) (if /m isn't in effect)
        Thanks, ikegami. I had remembered that there seemed to be no need for an interior $ followed by an escape, but I failed to think outside the box I had constructed for myself in the original question.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1096367]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-29 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls