I have a list of 250 items. I need to print the first 5 items to one file and then 20 each to successive files.
I've got a bug somewhere in here because the output is 5 items each in all files.
Here is the code: (btw, I've tried a bunch of other test statements before this all yeilding the same results)
Which outputs:Code:$results_on_first_page = 5; $results_per_page = 20; $number_of_pages = 16; for ($i = 1; $i <= $number_of_pages; $i++) { SWITCH: for ($i) { ($i eq 1) && do { $schools_on_THIS_page = $results_on_first_page; print "$i: $schools_on_THIS_page\n"; last; }; ($i > 1) && do { $schools_on_THIS_page = $results_per_page; print "$i: $schools_on_THIS_page\n"; last; }; die "No match: $!\n"; } #PRINT STATEMENTS HERE }
And for some reason, omitting the new line character prevents the whole line from being printed.Code:1: 5 2: 5 </div> 3: 5 </div> 4: 5 </div> 5: 5 </div> 6: 5 </div> 7: 5 </div> 8: 5 </div> 9: 5 </div> 10: 5 </div> 11: 5 </div> 12: 5 </div> 13: 5 </div> 14: 5 </div> 15: 5 </div> 16: 5 </div>






Bookmarks