[ILUG] Re: [ILUG], [OT]regular, expressions

From: Nick Hilliard (nick at domain iol.ie)
Date: Fri 27 Aug 1999 - 10:28:26 IST


> $lin =~ s/[\.,\,,\',\-]//
> and when it didn't I tried the same thing with a translation; ie
> $lin =~ tr/[\.,\,,\',\-]//
>
> neither works; why not? Please?

s/ only replaces one instance for a given data set. If you need to replace
all instances of the regexp, you need to use the /g directive. You regexp
looks basically ok, you perhaps you should try:

$lin =~ s/[\.,\,,\',\-]//g;

You may also want to remove backticks (`).

Nick



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:30 GMT