2012-07-24 14:57:44 +02:00
|
|
|
#!/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
|
2012-07-28 14:24:37 +02:00
|
|
|
# spider-mario
|
2012-07-24 14:57:44 +02:00
|
|
|
|
|
|
|
|
2012-07-24 16:57:21 +02:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use utf8;
|
|
|
|
|
|
|
|
my %hash;
|
|
|
|
|
2012-07-28 14:25:53 +02:00
|
|
|
{
|
|
|
|
local @ARGV = @ARGV;
|
|
|
|
while ((my ($source, $target), @ARGV) = @ARGV) {
|
|
|
|
unless ($source eq $target) {
|
|
|
|
push @{$hash{$target}}, $source;
|
|
|
|
}
|
2012-07-24 16:57:21 +02:00
|
|
|
}
|
2012-07-24 14:57:44 +02:00
|
|
|
}
|
|
|
|
|
2012-07-28 14:25:53 +02:00
|
|
|
while ((my ($source, $target), @ARGV) = @ARGV) {
|
2012-07-24 16:57:21 +02:00
|
|
|
if ($source eq $target) {
|
|
|
|
my @list = @{$hash{$source} // []};
|
|
|
|
print $source;
|
|
|
|
print ' (', join(' ', @list), ')' if @list;
|
|
|
|
print "\n";
|
|
|
|
}
|
2012-07-24 14:57:44 +02:00
|
|
|
}
|