Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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

by McA (Priest)
on Apr 02, 2013 at 09:42 UTC ( #1026640=note: print w/replies, xml ) Need Help??

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

Thank you for the snippet (++). Could you prove on Windows?


Replies are listed 'Best First'.
Re^7: File::Random module (McA)
by gautamparimoo (Beadle) on Apr 02, 2013 at 09:50 UTC

    @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

      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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2016-10-26 00:39 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (330 votes). Check out past polls.