http://qs321.pair.com?node_id=376964


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