#!perl-w
$day=22;
$month=7;
$year=104;
print "$day\-".($month+1)."-".($year+1900)."\n";
####
print $day,"\-",($month+1),"-",($year+1900),"\n"; # less expensive
##
##
#! perl-w
$day=22;
$month=7;
$year=104;
$count=-5;
use Benchmark qw(:all) ;
$results = timethese($count,
{
'Concatinated' => sub { print $day."\-".($month+1)."-".($year+1900)."\n";},
'Commafied' => sub { print $day,"\-",($month+1),"-",($year+1900),"\n"; },
},
'none'
);
cmpthese( $results ) ;
##
##
Rate Commafied Concatinated
Commafied 74894/s -- -71%
Concatinated 260000/s 247% --
##
##
print $day."\-".($month+1)."-".($year+1900)."\n"; # less expensive