PERL: Snippet which traverses from root folder to sub folder inside it Ноябрь 17, 2008
Posted by russenreaktor in development, linux, perl, programming.Tags: directory, perl
add a comment
«#!/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
Perl File Handling: open, read, write and close files Ноябрь 14, 2008
Posted by russenreaktor in linux, programming.Tags: perl, programming
add a comment
«open FILE, «>file.txt» or die $!;
print FILE $str;
close FILE;» perlfect.com
How do I install Perl modules? Ноябрь 8, 2008
Posted by russenreaktor in linux.Tags: linux, modules, perl
add a comment
«Installing a new module can be as simple as typing perl -MCPAN -e ‘install Chocolate::Belgian’» cpan.org