my @online_services = `svcs` =~ /^online.*svc:(.*?):/gm;
####
#! perl
use strict;
use warnings;
use Benchmark 'cmpthese';
use Data::Dump;
use experimental 'smartmatch';
my (@x, @y);
cmpthese
(
100,
{
MAP => sub { @x = map { /\d+_(\S*?)\.pl$/ } `ls -l` },
G_MOD => sub { @y = `ls -l` =~ /\d+_(\S*?)\.pl$/gm },
}
);
if (@x ~~ @y)
{
printf "The arrays are equal; each has %d elements\n", scalar @x;
}
else
{
print "The arrays are different:";
dd \@x;
print "----------\n";
dd \@y;
}
##
##
13:56 >perl 720_SoPW.pl
Rate MAP G_MOD
MAP 47.1/s -- -32%
G_MOD 68.9/s 46% --
The arrays are equal; each has 619 elements
13:59 >