in reply to Common Perl Idioms
Some of the ones I can remember off the top of my head...
# slurp a bunch of files @files = { local(@ARGV, $/) = @filenames; <> }; # get the indexes of items in an array @foo{ @foo } = 0 .. @foo; $foo{'abc'} # the index of 'abc' in @foo # Get the sign of a number $a <=> 0 # test primality sub isPrime { (1 x $_[0]) !~ /^(11+)\1+$/ } # (ok I never use that in production code # but it is funny)
Ted
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Common Perl Idioms
by revdiablo (Prior) on Jul 23, 2004 at 21:19 UTC | |
by Anonymous Monk on Jul 23, 2004 at 23:21 UTC | |
Re^2: Common Perl Idioms
by I0 (Priest) on Jul 24, 2004 at 07:10 UTC | |
Re^2: Common Perl Idioms
by davorg (Chancellor) on Jul 24, 2004 at 06:36 UTC | |
by adrianh (Chancellor) on Jul 25, 2004 at 23:18 UTC | |
Re^2: Common Perl Idioms
by Anonymous Monk on Jul 27, 2004 at 14:48 UTC | |
by Eimi Metamorphoumai (Deacon) on Jul 27, 2004 at 14:55 UTC | |
by Anonymous Monk on Jul 27, 2004 at 15:09 UTC | |
by dragonchild (Archbishop) on Jul 27, 2004 at 14:52 UTC |
In Section
Meditations