Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

fw (8970)

fw
  (email not shown publicly)

Journal of fw (8970)

Tuesday April 06, 2010
02:26 AM

more commands!

In reply to fREW Schmidt's and Ovid's top 10 history commands, here is my list:

fw@hal2 ~ :) % history -n 1 | awk {'print $1'} | sort | uniq -c | sort -k1 -rn | head
  13299 cd
   7846 ls
   7126 perl
   5755 vim
   3117 git
   2893 sudo
   1319 exit
   1134 lt
    977 rm
    817 perldoc

alias lt='ls -ltr'

(this is from my eternal zsh history which started on Nov 4th, 2008)

-- Frank

Tuesday December 09, 2008
04:43 PM

First Perl6 program

This one reads STDIN, counts words (here words are things between whitespace), and prints them sorted in descending order by occurrence.

my %words;

$*IN.lines.split(/\s+/).map: { %words{$_}++ };

for %words.pairs.sort: { $^b.value <=> $^a.value } -> $pair {
    say $pair
}

see also: this node at perlmonks