#---------------------------------------
use strict; use warnings; use diagnostics;
use Benchmark qw(:all);
my $var;
cmpthese(1000000, {
test1 => 'use Fcntl; sysopen (my $filea, "afile.jpg", O_RDONLY);
sysread $filea, $var, 500;',
test2 => 'open (my $fileb, "afile.jpg");
read $fileb, $var, 500;',
}
)
#--------------------------------------------
Find, delete and copy empty dirs and dirs with only empty subdirs
#!/usr/bin/perl
use File::Find;
finddepth (\&empdir, ($ARGV[0] || '.'));
sub empdir {
return unless -d;
rmdir($_);
mkdir "/tmp/$_"; # adicionalmente copiamos a temp para ver qué se
+ha borrado
}
#--------------------------------------------
|