You may want to do this with sprintf rather than a regex, check out: perldoc -f sprintf
I believe because your regex isn't grouping any terms it is returning a status of true or false, aka 1 for true since your regex does in fact match. You might try paren's around the whole thing if you still want to do it this way, that is not using sprintf. http://danconia.org ------------------------------------------------ On Tue, 31 Dec 2002 10:16:28 -0800, "David O'Dell" <[EMAIL PROTECTED]> wrote: > I have a variable: > $NUM = '14.45905495'; > and I want to remove the trailing digits and only leave 2 after the period > so it ends up > > '14.45' > > I've tried to do this but it appears to return as an array and always prints > out "1". > > #!perl -w > > $NUM = '14.45905495'; > @POST = ($NUM =~ /\d\.\d{2}/); > print "new value is $POST[0]\n"; > > after being run > > > $ ./test_ex.pl > new value is 1 > > > > > -- > 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]