>>>>> "Ramprasad" == Ramprasad A Padmanabhan <[EMAIL PROTECTED]> writes:

Ramprasad> Hello all,
Ramprasad>   Suppose I have a huge array of filenames and I want to move them
Ramprasad> I would like to  move 1 chunk at a time on 'n' elements

Ramprasad> How Can I efficiently do it ?

Ramprasad> something like

Ramprasad> @allfiles  = (....)   # 10000 files

My pattern for that is:

    my @copy = @allfiles; # destructive... so we have to copy

    while (@copy) {
      my @chunk = splice @copy, 0, 100; # remove first 100 elements (or less)
      ... do something with @chunk ...
    }

Seems to work quite easily.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to