use Benchmark qw; my $string = 'Long string' x 1000; my $really_long = $string x 100; my $ref = \$string; my $long_ref = \$really_long; cmpthese(-5, { map { $_ => "length($_)" } qw< $string $$ref $really_long $$long_ref > }); __END__ Rate $$long_ref $$ref $really_long $string $$long_ref 17305170/s -- -9% -36% -38% $$ref 18937129/s 9% -- -30% -32% $really_long 27185304/s 57% 44% -- -2% $string 27870647/s 61% 47% 3% --