Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: regex error (backslashing)

by LanX (Canon)
on Apr 06, 2013 at 15:30 UTC ( #1027289=note: print w/ replies, xml ) Need Help??


in reply to regex error

> It's OK when I type directly not using a string var.

Different things!

> $binpath="c:\\qa\\kontor\\bin"

here you are backslashing to avoid string-interpolation within "doublequotes"

> if( $ENV{PATH} !~ /c:\\qa\\kontor\\bin/i)

here you are backslashing to avoid special escape \commands like \k

So in your code you need 2 levels of escapes!

$binpath="c:\\\\qa\\\\kontor\\\\bin";

Do better combine 'singlequotes' and quotemeta \Q and you avoid any explicit backslashing.

Cheers Rolf

( addicted to the Perl Programming Language)


Comment on Re: regex error (backslashing)
Select or Download Code
Re^2: regex error (backslashing)
by anaconda_wly (Scribe) on Apr 07, 2013 at 07:58 UTC
    Thanks to all. I use index function also solve this issue.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-07-07 01:52 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 (86 votes), past polls