#!/usr/bin/perl -w use strict; use Benchmark qw(cmpthese); cmpthese( -5, { '*=' => sub { my @numbers = (2, 3, 4, 5); my $total = 1; $total *= $_ for @numbers; }, 'pop' => sub { my @numbers = (2, 3, 4, 5); my $total = pop @numbers; $total *= $_ for @numbers; }, 'shift' => sub { my @numbers = (2, 3, 4, 5); my $total = shift @numbers; $total *= $_ for @numbers; } } );