Bret Goodfellow wrote:
Okay, I know this has to be simple, but because I am trying to truncate
or remove a special character I've run into a roadblock.  Here's what I
want to do. $value = "12345)" ; How do I change $value so that the trailing ")" is removed. In
otherwords with the given example, how do I manipulate $value so that
its value is "12345"?  Please keep in mind that $value may be variable
in length, so I can't use substr($value, 0, 5).  Can split be used to do
this?  Stumped.

$value =~ s/\D+//g;

Or:

$value =~ tr/0-9//cd;


John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to