Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Matching character

by Lotus1 (Deacon)
on Jul 21, 2013 at 16:11 UTC ( #1045517=note: print w/replies, xml ) Need Help??

in reply to Re: Matching character
in thread Matching character

This is easy to do when typing code directly into a node, you would catch this quickly but for the new monks:

$str = "testing\";

The backslash in this case will escape the double quote (") and with warnings turned on you get this:

Can't find string terminator '"' anywhere before EOF at C:\b\perlmonks\regex\ line 4.

Without warnings you get "Bareword found where operator expected at ..."

use strict; use warnings; my $str = "testing\\"; print "matched!" if $str =~ /\\$/;

Replies are listed 'Best First'.
Re^3: Matching character
by vinoth.ree (Monsignor) on Jul 22, 2013 at 05:58 UTC

    Lol Lotus1

    You are right. I did not test. Thanks

    All is well

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2016-10-22 16:50 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (297 votes). Check out past polls.