Using Ubuntu 18.04 the default perl. Have tried to understand this code but not getting expected results. Any help please. tia oldcity
########################################## sub OPEN_200R { open(FILE, '<', 'CATAGORIES.DAT') or die("Could not open* file! +CATAGORIES DAT\n"); @lines = <FILE>; close(FILE); $gcnt = 0; foreach (@lines) { ($catg) = (split(/,/)); $gcnt = $gcnt + 1; chomp $catg; $catg[$gcnt] = $catg; if ($gcnt <= 5) { $catlgs5 = join '', $catg[$gcnt]; }elsif ($gcnt >= 6){ $catlgs6 = join '', $catg[$gcnt]; } # end of if gcnt print ("$catlgs5"); print ("$catlgs6 \n"); # chomp $catg; } # end of foreach at 200r # { ##########################################
Not results Expected. 1-AT&T 2-FP&L 3-WATER 4-GAS 5-PLAN-D 5-PLAN-D 6-AARP 5-PLAN-D 7-DIAZ 5-PLAN-D 8-DRUGS 5-PLAN-D 9-HOUSE 5-PLAN-D10-CAR 5-PLAN-D11-MISC
Had expected 2 rows 1 of 5 catgs and 1 of 6 catgs. How to fix?
In reply to Unexpected Results by oldcity
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |