Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: string substitution

by GrandFather (Saint)
on Dec 06, 2010 at 20:14 UTC ( [id://875685]=note: print w/replies, xml ) Need Help??


in reply to Re^2: string substitution
in thread string substitution

That's probably not doing what you want, at least according the your original problem specification which called for removing spaces between, rather than after, characters. Consider:

use strict; use warnings; my $str = "The quick & the dead."; $str =~ s/(\W)\s+/$1/g; print $str;

Prints:

The quick &the dead.
True laziness is hard work

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-24 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found