#!/usr/bin/perl -w use strict; use Benchmark; { # Start the benchmark my $start = new Benchmark; for(1..1000) { print qq($ENV{PATH}\n); } # End the program and return the Benchmark time my $end = new Benchmark; print "Processing time was...\n"; print timestr(timediff($end, $start)) . "\n"; } sleep 10; { my $foo = $ENV{PATH}; # Start the benchmark my $start = new Benchmark; for(1..1000) { print qq($foo\n); } # End the program and return the Benchmark time my $end = new Benchmark; print "Processing time was...\n"; print timestr(timediff($end, $start)) . "\n"; } #### Loop using $ENV{PATH}: 12 wallclock secs ( 0.13 usr + 0.15 sys = 0.28 CPU) Loop using $foo: 11 wallclock secs ( 0.07 usr + 0.05 sys = 0.12 CPU)