On Aug 2, 12:11 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > On 8/1/07, Bret Goodfellow <[EMAIL PROTECTED]> 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"?
> if you want only the numbers at the start of the string: > #note: if there are no numbers at the start $value will be '' > $value =~ s/^(\d*)/$1/; Replacing the a match that's entirely captured with $1 is a no-op. I think you meant: $value =~ s/^(\d*).*/$1/; or $value =~ /^(\d*)/ and $value = $1; > or > #note: if there are no numbers at the start* $value will be zero > $value += 0; This will cause a warning to be displayed if warnings are properly enabled. Locally disable the warning with: { no warnings 'numeric'; $value += 0; } Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/