|
|
my
($progname)
=
$0
=~
m{^(?:.*/)?(.*)$};
perl -MMIME::Decoder -e '(new MIME::Decoder "base64")->decode(\*STDIN, \*STDOUT)'
print map {caller $_ && sprintf(" %s called from %s %s\n", (caller $_)[3,1,2])} 0..9;
perl -MCPAN -e shell
export FTP_PASSIVE=1 perl -MCPAN -e shell
perl
-d:DProf
prog.pl
dprofpp
-u
dprofpp
-u
-p
prog.pl
sub
cartprod{my$a=shift;[map{my$y=$_;map{[$_,@$y]}@$a}@_?@{cartprod(@_)}:[]]}
sub
perm{@_?map{my$e=$_[$_];map[$e,@$_],perm(@_[0..$_-1,$_+1..$#_])}0..$#_:[]}
sub
random_perm{my@r;push(@r,splice(@_,int(rand()*@_),1))while(@_);@r}
sub
subsets {map{my$n=$_;[@_[grep{$n&1<<$_}0..$#_]]}(1..2**($#_+1));}
sub
nonempty_subsets{map{my$n=$_;[@_[grep{$n&1<<$_}0..$#_]]}(1..2**($#_+1)-1);}
sub
remove_random_elt{my$r=@_[0];@$r?splice(@$r,int(rand()*@$r),1):undef}
|
|
|