Can anyone help with this????
I have the following array:
1,10400000209458
2,10400000328655
3,10400000847094
4,10400001030406
5,10400002093756
I need to create a script that goes through this array(@temp_array), and
creates various output files with N rows in each file. Here's what I
have
so far.
####WRITE CONTENTS OF AN ARRAY TO OUTPUT FILES####
for ($i=0; $i < $num_of_files; $i++){
open(OUT,">$file_$seq_num.txt");
foreach $item (@temp_array){
#
# I NEED SOME LOGIC HERE
#
($row_num,$prepaid_card_num) = split(/,/,$item);
print OUT "$row_num,$prepaid_card_num\n";
} #end of foreach loop
close(OUT);
$seq_num = $seq_num+1;
} #end of for loop
If I wanted to break this up into 3 files, and max number of lines in
each
file is 2(in this case 2 files w/ 2 rows, 1 file with 1 row).
How can I code this???
Thanks,
Boris