Help for this page

Select Code to Download


  1. or download this
    my @n; $n[$_{$_}] = $_ for map{$_{$_}++; $_} @list;
     
    print "Most frequent: $n[-1]";
    
  2. or download this
    sub most_frequent{ local *_=*_; $_[$_{$_}] = $_ for map{$_{$_}++; $_} 
    +@_; $_[-1]; }