From 70c27ca36f696b12012d7f47ac3071f747b95207 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 1 Aug 2012 03:33:30 +0200 Subject: some edits --- linklist.pl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 linklist.pl (limited to 'linklist.pl') diff --git a/linklist.pl b/linklist.pl new file mode 100755 index 0000000..c0377aa --- /dev/null +++ b/linklist.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +# ponysaylist +# Prints a list of ponies in columns +# +# Licensed under WTFPL +# See COPYING for details + +# Author: Mattias Andrée, maandree@kth.se +# spider-mario + + +use strict; +use warnings; +use utf8; + +my %hash; + +{ + local @ARGV = @ARGV; + while ((my ($source, $target), @ARGV) = @ARGV) { + unless ($source eq $target) { + push @{$hash{$target}}, $source; + } + } +} + +while ((my ($source, $target), @ARGV) = @ARGV) { + if ($source eq $target) { + my @list = @{$hash{$source} // []}; + print $source; + print ' (', join(' ', @list), ')' if @list; + print "\n"; + } +} -- cgit