blob: c0377aa08a1c9b4bcb7f26cb3931c8d74ccbc5be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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";
}
}
|