CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Regular Expressions:
How to substitute double quotes



Oct 13, 2000, 12:09 PM

Post #1 of 2 (4517 views)
How to substitute double quotes Can't Post

I want to remove all double-quotes in a string variable. I tried this:

$variable =~ s/"//g;

The quotes remain. What am I doing wrong?


Oct 17, 2000, 6:49 AM

Post #2 of 2 (4517 views)
Re: How to substitute double quotes [In reply to] Can't Post

that should work, I would think. But you can try this, it will work guaranteed. If you still have a problem, then you need to look elsewhere in your code.

$variable =~ tr/"//d;

This is the transliterate operator. The d at the end specifies to delete all the quotes. Learning Perl, the llama book has a section on this in chapter 15 that you may want to look at, or if you have Programming Perl, 3rd edition, you can read up on it in chapter 5. If you don't have some perl books, go get them.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives