I want to count how many cities are listed so the above would have 6 as the count. My attempt below gives me a count of 1. Please advise how I can do it correctly??san francisco; oakland; new york city; boston; miami; detroit;
my $filename = 'myname.txt'; my $ct = 0; open FILE, $filename || "$!"; while(<FILE>) { chomp; my @arr = split /;/, $_; $ct++ } print $ct; close FILE;
In reply to Count of split data by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |