Month: July 2009

Printing Environment Variables Using Perl One Liner

Solution1 C:Documents and Settingssivkumar>perl use Data::Dumper; print Dumper %ENV; Solution2 - PerlOne Liner perl -MData::Dumper -e "print Dumper [...]

Tilde-Tilde Operator

A bit obscure is the tilde-tilde "operator" which forces scalar context. print ~~ localtime; is the same as print scalar localtime; and different [...]

Spaceship Operator.

Easy with theSpaceship Operator. $a =2<=>5;# $a is set to -1 $a =5<=>2;# $a is set to 1 $a =2<=>2;# $a is set to [...]

Non-Obvious features in perl.

For example, did you know that there can be a space after a sigil? $ perl -wle 'my $x = 3; print $ x' 3  Or that there you can give subs numeric names if you [...]