On Apr 15, Daniel Falkenberg said:

>I was just wondering how I would go about stripping the $ sign from the
>following string?
>
>$string = "$20.90";

That won't do what you expect -- $string is probably ".90" now.  $20 is a
variable (set by a regex) and is probably undef.  You need either '$20.90'
or "\$20.90".

>$string =~ s/$//; <-- I figured this would work fine?

No; $ is the end-of-string anchor in a regex.  Use s/\$// instead, or
tr/$//d.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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

Reply via email to