O'Reilly Answers is a community site for sharing knowledge, asking questions, and providing answers that brings together our customers, authors, editors, conference speakers, and Foo (Friends of O'Reilly). More »
If you want to make random numbers in a given range, inclusive, such as when you randomly pick an array index, simulate rolling a die in a game of chance, or generate a random password, use Perl's...
If you want to round a floating-point value to a certain number of decimal places, use the Perl function sprintf, or printf if you're just trying to produce output:
# round off to ...
If you want to match numbers that use the comma as the thousand
separator and the dot as the decimal separator, refer to the following examples:
Mandatory integer and fraction:^[0-9]{1,3...