Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Re: How do I remove all of the blank spaces in a string?

by marcink (Monk)
on Jun 08, 2001 at 02:46 UTC ( [id://86797]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: How do I remove all of the blank spaces in a string?
in thread How do I remove all of the blank spaces in a string?

As usual, there's a wide choice of ways to do this ;-) A couple of ways of converting slashes to letters 'q':

Method one: backslash
s/\//q/g

Method two: cool s/// syntax
s|/|q|g
s(/)(q)g
s{/}{q}g
You don't have to use slashes in s/// -- take a look at 'man perlop'.

Update: Are you sure you don't want to take a look at Date::Manip and Date::Format? There's a nice parseDate function in the former ;-)

And one more s/// that probably does exactly what you want, in one pass:
s{(\d\d)/(\d\d)/(\d\d\d\d)\s+(\d\d):(\d\d):(\d\d)}{$1$2$3$4$5$6}

-mk

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found