blob: 4d3492826f9d4e43f84fe913d6b18545cceb56b0 (
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
use strict;
use warnings;
use utf8;
use List::MoreUtils qw(natatime);
my %hash;
my $it = natatime 2, @ARGV;
while (my ($source, $target) = &$it) {
unless ($source eq $target) {
push @{$hash{$target}}, $source;
}
}
$it = natatime 2, @ARGV;
while (my ($source, $target) = &$it) {
if ($source eq $target) {
my @list = @{$hash{$source} // []};
print $source;
print ' (', join(' ', @list), ')' if @list;
print "\n";
}
}
|