CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Array processing in perl

 



perl_aroha
Novice

May 29, 2010, 6:56 PM

Post #1 of 3 (800 views)
Array processing in perl Can't Post

Hi,

There is a script which I am invoking inside my original perl script using a system command.

The inner script takes an array element as an arguments

system("/xyz/batch_f -a analyze -c specific -l $_ &") foreach @batch;

I want the inner script "batch_f" to process only 4 elements of an array at a time simultaneously & then wait for 30 sec & then again proceed with the remaining ones.

I tried using splice but no luck. Need an expert advice.

Thanks in advance.


BillKSmith
Veteran

May 29, 2010, 8:22 PM

Post #2 of 3 (797 views)
Re: [perl_aroha] Array processing in perl [In reply to] Can't Post

splice should work.


Code
  

use strict;
use warnings;

my @array = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
while (@array) {
my @temp4 = splice @array, 0, 4;
print @temp4, "\n";
sleep 30;
}



Process @temp4
Good Luck,
Bill


perl_aroha
Novice

May 29, 2010, 11:03 PM

Post #3 of 3 (789 views)
Re: [BillKSmith] Array processing in perl [In reply to] Can't Post

Thanks Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives