How To Count Lines In A String Variable Using Perl
1 |
my $count = () = $string =~ /\n/g; |
1 |
my $count = () = $string =~ /\n/g; |
1 2 3 4 5 |
my $needle = 'foo'; my $haystack = 'foo foo foo'; my @count = $haystack =~ /$needle/g; my $count = scalar @count; print "$count\n"; |
Should result in 3
1 |
sudo lsof | awk '{print $3}' | sort | uniq -c | sort -n -r | head -20 |
13137 erics 2421 root 330 _www 139 _mdnsresponder 56 _softwareupdate 34 _coreaudiod 33 _mysql 32 _networkd 23 _assetcache 21 _usbmuxd 21 _locationd 18 _spotlight 13 _nsurlsessiond 13 _netbios 13 _appleevents 10 _windowserver 10 _iconservices 10 _displaypolicyd 8 _nsurlstoraged 8 _distnote
Just be sure to add the class “yourClass” to each checkbox in the group you wish to count and it is as simple as:
1 |
alert( 'Qty checked: ' + jQuery('.yourClass:checked').length ); |
1 2 3 4 5 6 7 |
my $value = $dbh->fetch_one_value( 'table' => 'users', 'columns' => 'COUNT(*)', 'where' => { 'active' => 1, }, ); |
[code]SELECT city, sum(is_special) as special_count FROM stores where state="$state" group by city[/code]