#!/bin/perl my $currentIndex = 0; my %data; while ( <> ) { s/ //; s/\n//; my $line = $_; my $currentIndex = uc substr($line,0,1); if ($line =~ /^\d/ ) { push @{$data->{"0-9"}}, $line; } else { push @{$data->{$currentIndex}}, $line; } } my @keys = sort keys %$data; foreach (@keys) { my $cardCount = scalar @{$data->{$_}}; print $_ . " => $cardCount \n"; $totalCardCount += $cardCount; } my $headerRow = &getHeader( \@keys ); open OUTFILE, ">cardList.txt"; #print index keys of cards # print the miki card count information print OUTFILE<{$key}} + 1; print OUTFILE "

"; print OUTFILE "$key" ; print OUTFILE " ($cardCount)" if ($cardCount > 10 ); print OUTFILE " Back to [[#Top]]

\n"; print OUTFILE "\n\n"; close OUTFILE; } sub getHeader { my $listRef = shift; my @list = map "
  • [[#$_]]
  • ", @{$listRef}; shift( @list ); # remove the link to the first set of cards my $listItems = join "\n", @list; return "__NOTOC__ \n\n"; }