#!/usr/bin/perl -w use strict; use warnings; my $func_done; my $func_return; my $max=1000000; my %myhash; DoIt($max); $func_return = (times)[0]; printf "Size of myhash is %d\n", 0 + keys %myhash; printf "Return took %.4f CPU seconds\n", $func_return - $func_done; sub DoIt{ my $limit=shift; my $i; foreach $i (0..$limit){ $myhash{$i}=1; } $func_done = (times)[0]; return; }