blob: b7b4c6e96a20a2e2a5fee3816be410c63751c227 (
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
36
|
#!/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";
}
}
|