Grygonos,
If your goal is to delete a specific character and you want to do it through your entire string - it would probably be better to use tr.
$row[0] =~ tr /\///d;
To answer the question you asked - you would need to add the g modifier to make the substitution global and to make it a null, you would make the subsitution empty:
$row[0] =~ s/\///g;
You may also want to check out changing your delimiters so that you avoid the "leaning toothpick" syndrome.
Cheers - L~R
| [reply] [d/l] [select] |
No 12s31/2002 because:
- The subtitution part of the regexp is treated as a double quoted string and \s is not a valid escape (enabling warnings would have told you that)
- Only the first occurance is replaced unless you specify the /g modifier.
You want s/\///g;
Unless you wanted a literal null character in which case its \0 in the substituion (I think I don't have my camel with me).
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere." | [reply] [d/l] |
in response to the responses..
- thanks . I meant to post the one without the /s hehe I had taken it out and grabbed the wrong one to paste. thanks . I forgot about the g mod
- tr does seem like a better option.
- I don't choose the delimiter unfortunately :( unless you are referring to the / in the regex... which I didnn't know there was any way to use another one? did you mean $row[0] =~ s,\/,,glike using a different regex delimiter? or did you mean the /'s in the field?
Thanks for all your responses .. problem solved... multiple ways :)
| [reply] [d/l] |
Yeah, you can use (just about) anything as your regexp delimiter, and if you use something other than / you don't need to escape it. So s,/,,g or tr,/,,d (or whatever other delimiter strikes your fancy; I'm fond of matched delimiters like tr{/}{}d, but that's just me).
| [reply] [d/l] [select] |
\s is whitespace. try s/\///g;.
-s. | [reply] [d/l] [select] |
\s is only whitespace in a regexp, not in the
substitution part. There \s is just an s.
Abigail
| [reply] |
$row[0] =~ s/\//\0/g;
But you probably just want to remove '/', so it's:
$row[0] =~ s/\///g;
Hope this helps!
Michele. | [reply] [d/l] [select] |