Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to remove double quotes?

by andreychek (Parson)
on Jun 05, 2001 at 20:50 UTC ( [id://85879]=note: print w/replies, xml ) Need Help??


in reply to How to remove double quotes?

If I'm correct in what it is you are looking for, you could just do this:
my $string = qq{"Hello there"}; $string =~ s/"/'/g;
That uses a simple regular expression to change every double quote to a single quote.
You could, instead of a single quote, replace it with any character you like. HTH
-Eric

Update
Ack, apparently, you have to type pretty fast or else 5 people get their answers in before you do ;-)
Would anyone care to share why perl can do tr/"/'/ faster than s/"/'/?

Replies are listed 'Best First'.
(bbfu) (tr/// vs s///) Re(2): How to remove double quotes?
by bbfu (Curate) on Jun 05, 2001 at 22:25 UTC
      Would anyone care to share why perl can do tr/"/'/ faster than s/"/'/?

    Because s/// has to be able to handle all RE syntax and specialness while tr/// just considers its input to (mostly) be a simple character class. Much easier to deal with and, thus, much faster.

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-23 20:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found