#!/usr/bin/perl -w use strict; use Data::Dumper; my @list; populate_list(\@list,10000000); countdown(10); @list = (); #list has nothing in it now countdown(10); sub populate_list { my ($lref,$num) = @_; foreach my $x (0..$num) { push (@$lref, $x); } } sub countdown { my $num = shift; while ($num--){sleep(1);print "countdown $num\n";} }