ehm, that's really not what you want...

see, [] is already a character CLASS.. which means 'any character between these 
braces' - in short, an implied OR.


for example:

kane@outcast> perl -e '$_=q[-a|b.c];s/[-|\.]//g;print'
abc
kane@outcast>

as you can see, the | symbol ALSO got removed..

on a side note, escaping the . is also pointless... since a . is everything, a 
character class like this [.] would be the same as saying .
so, perl Does The Right Thing, and takes a literal .
(escaping the . will give you a warning under bleadperl for sure)

what you want is s/[-.]//g;

regards,
jos

Quoting Roger C Haslock <[EMAIL PROTECTED]>:

> Perhaps
> s/[-|\.]//g; # replace any dash or (escaped) dot with nothing
> 
> ----- Original Message -----
> From: "Scott" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, January 04, 2002 7:48 PM
> Subject: More formatting questions
> 
> 
> > First off, thank you to everyone who has helped me dive into perl full
> > force this week.  I am glad I am getting to know the language!
> >
> > My question is about formatting.  I need to strip a decimal out of a
> > number and dash out of a date.  I am importing a file and then
> > reformatting it for export to a mainframe.  The number's come in like
> > this:  100.05, I need to strip out the decimal from that and just
> display
> > 10005.  With dates they are coming in 2002-01-03, here I need to just
> > display 20020103.
> >
> > Thanks in advance.
> >
> > -Scott
> >
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to