Răzvan Cosma's scratchpad

random scripts of random value

Browsing Posts in Perl

Assumes ‘sudo’ is required. Net::OpenSSH::Parallel installed using cpanspec on CentOS 7

perl -MExtUtils::Installed -e “use v5.10; $i=ExtUtils::Installed->new(); @m=$i->modules(); foreach $mm (@m) {say $mm .’ – ‘. $i->version($mm);}”

find maxdepth

2 comments

$ perl -e ‘use File::Find; find (sub { $d=$File::Find::dir=~tr[/][]; return if $d>6; if (-f and /config.xml/) {open $f,”

perl -MDate::Manip -e ‘Date_Init(“Language=Romanian”,”DateFormat=non-US”); print UnixDate(DateCalc(“azi”,”+ 18 zile lucratoare”),”%A, %e %B %Y%n”)’ Output: marti, 8 decembrie 2009 perl -MDate::Manip -e ‘Date_Init(“Language=Romanian”,”DateFormat=non-US”); @date=ParseRecur(“fiecare simbata din decembrie”); foreach (@date) {$d=UnixDate($_, “%A, %e %B %Y%n”); $d=~s/(\w+)/\u\L$1/g; print $d}’ Simbata, 5 Decembrie 2009 Simbata, 12 Decembrie 2009 Simbata, 19 Decembrie 2009 Simbata, 26 Decembrie 2009

$count{$_}++ while ; print “$count{$_} = $_” for sort(keys %count);

From Larry Wall himself: $op = shift or die “Usage: rename expr [files]\n”; chomp(@ARGV = <STDIN>) unless @ARGV; for ( @ARGV ) { $was = $_; eval $op; die $@ if $@; rename ( $was, $_ ) unless $was eq $_; }

Bad Behavior has blocked 106 access attempts in the last 7 days.