in reply to arrays within arrays?

This is a little shorter, possibly faster, definitely nicer on memory on big directories, plus it spits out what is going on (would have been shorter without the print)

#!/usr/local/bin/perl use File::Find qw(find); my $dir_pre = '/opt/stats/data/split/vn; my @dirs = (); push @dirs, $dir_pre.$_ for (1..6); find( sub{ next unless -f; print "unlinking \"$_\"\n"; unlink $_ || warn $!; }, @dirs);


my @a=qw(random brilliant braindead); print $a[rand(@a)];

Replies are listed 'Best First'.
Re: Re: arrays within arrays?
by trowa (Acolyte) on Apr 27, 2001 at 20:00 UTC
    Okay, I'm going to try a little benchmark test today. Three differents ways are better then one. These scripts have been invaluable, thanks... "In God we trust, all others bring data." - trowa