in reply to extract number of times a value appears in an array

Try
#!/usr/bin/perl -w use strict; my @items = ( 1, 3, 3, 1,3, 5, 5, 5, 5,3 ); my %count; $count{$_}++ for (sort @items); print "day ".$_." appeared ".$count{$_}." times\n" for (keys %count);