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

Re: Perl regex. Why does this happen?

by hippo (Bishop)
on Jun 03, 2016 at 09:29 UTC ( [id://1164845]=note: print w/replies, xml ) Need Help??


in reply to Perl regex. Why does this happen?

The problem is that \s matches any type of whitespace including the newline. If you change your regex line to be:

$list =~ s/ {2}/2/g;

it should work as you intend.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-03-28 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found