November 17, 2008

PERL: Snippet which traverses from root folder to sub folder inside it

"#!/usr/bin/perl
use strict;

&smash("/archive");

sub smash {
my $dir = shift;
opendir DIR,
$dir or return;
my @contents = map "$dir/$_", sort grep !/^\.\.?$/, readdir DIR;
closedir DIR;
foreach (@contents) {
next unless !-l && -d;
&smash($_);
}
}" forums.devshed.com

November 8, 2008

How do I install Perl modules?

"Installing a new module can be as simple as typing perl -MCPAN -e 'install Chocolate::Belgian'" cpan.org