taken from perlfaq8 This is a difficult question to answer, and the best answer is only a guess. What do you really want to know? If you merely want to know if one of your filehandles is connected to...
05 November 2009 - 09:23 AM | 0 CommentsAsked by sanichi
04 November 2009 - 01:24 PM
Here's a benchmark with Perl 5.010. Note that 5.010 has a new /p flag that supplies a ${^MATCH} variable that acts like $& but for only one instance of the match or substitution oper...
04 November 2009 - 08:02 AM | 0 Comments
There is a variety of software (including the Unix command-line utility uniq and Windows PowerShell cmdlet Get-Unique) that can help you remove duplicate lines in a file or ...
30 October 2009 - 08:35 AM | 0 Comments
Perl understands numbers specified in binary (base-2), octal (base-8), and hexadecimal (base-16) notation only when they occur as literals in your programs. If they come in as data—such as by readin...
20 October 2009 - 05:10 PM | 0 Comments
If you want to multiply a pair of two-dimensional arrays, use the PDL modules, available from CPAN. PDL is the Perl Data Language—modules that give fast access to compact matrix and mathematical fun...
20 October 2009 - 04:53 PM | 0 Comments
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...
20 October 2009 - 04:01 PM | 0 Comments
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 ...
20 October 2009 - 03:40 PM | 0 Comments
If you want to convert between regular numbers and Roman numerals, use the Roman module from CPAN: use Roman; $roman = roman($arabic); # convert to roman numerals ...
20 October 2009 - 03:30 PM | 0 Comments
If you have a string representing a headline, the title of book, or some other work that needs proper capitalization, use a variant of this tc( ) titlecasing function: INIT { our %nocap;...
20 October 2009 - 03:11 PM | 0 Comments