in reply to Passing Array of Arrays
I am trying to build an array of arrays in one function, pass it out in to the main scope of the script, then back into another function to print it's contents.Something like this perhaps
Could I also suggest a refactoring of your first function (now just returns a list of files ordered by mtime)sub ret_arr { return( ["foo"],["bar"],["baz"] ) } sub print_arr { print @$_ for @_ } my @arr = ret_arr(); print_arr(@arr); __output__ foobarbaz
use IO::Dir; sub files_by_mtime { my $d = IO::Dir->new($_[0]) or die "ack: $!"; return map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, (stat "$_[0]/$_")[9] ] } grep { /^post.*\../ } $d->read; }
_________
broquaint
|
|---|