Site

Perl

Install perl module in local directory

1. use CPAN to download module

cpan
install Math::Random

2. CPAN install will fail. Assign the dir to install by yourself:

cd ~/.cpan/build/Math-Random
perl Makefile.PL PREFIX=~/install/perl
make
make install

3. Tell your code where to find the module:

use lib qw(~/install/perl/lib/site_perl/5.8.8);
use Math::Random;

Measure running time

use Time::HiRes qw(usleep ualarm gettimeofday tv_interval);

my @t0 = gettimeofday();

#####
## do something here
#####

my @t1 = gettimeofday();
my $elapsed = tv_interval( \@t0, \@t1 );