Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^7: File::Random module (McA)

by gautamparimoo (Beadle)
on Apr 02, 2013 at 09:50 UTC ( #1026642=note: print w/ replies, xml ) Need Help??


in reply to Re^6: File::Random module (McA)
in thread File::Random module

@tobyink That was not what i meant by random.. This think can be easily done the same way as u did by find(). Through random I wanted to see the random file as it is ie dont wanna create a array first and then select random files from it. Rather traverse the drive such that i get random files to process while traversing.. Any ideas?

One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. -Elbert Hubbard


Comment on Re^7: File::Random module (McA)
Re^8: File::Random module (McA)
by tobyink (Abbot) on Apr 02, 2013 at 16:17 UTC

    The following crawls a directory and prints out random file names. Each file has a 1 in 10 chance of being selected.

    use PIR; my $iter = PIR->new->file->iter($somedir); while (defined(my $file = $iter->())) { next if int rand 10; print $file, "\n"; }
    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026642]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2014-09-30 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (383 votes), past polls