Skip to content

Instantly share code, notes, and snippets.

Created August 4, 2014 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/179d74b99c2661773de8 to your computer and use it in GitHub Desktop.
Save anonymous/179d74b99c2661773de8 to your computer and use it in GitHub Desktop.
$ perl -Ilib -Mexperimental=signatures -Mojo -E 'say r g("reddit.com")->dom->find("*")->type->reduce({} => sub ($a, $b) { $a->{$b}++; $a })'
{
"a" => 433,
"b" => 1,
"body" => 1,
"button" => 5,
"code" => 1,
"dd" => 7,
"div" => 501,
"dl" => 1,
"dt" => 7,
"form" => 5,
"h1" => 2,
"h2" => 2,
"h3" => 3,
"head" => 1,
"html" => 1,
"i" => 6,
"iframe" => 1,
"img" => 19,
"input" => 20,
"label" => 10,
"li" => 177,
"link" => 6,
"meta" => 5,
"option" => 60,
"p" => 130,
"script" => 14,
"select" => 1,
"span" => 280,
"strong" => 1,
"style" => 2,
"table" => 2,
"td" => 7,
"th" => 1,
"time" => 37,
"title" => 1,
"tr" => 4,
"ul" => 47
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment