User:Ojw/SortList

my %Lines; foreach $Line(<>){ chomp $Line; if($Line =~ /\*\s*(.*)$/){ $Line = $1; $Name = $Line; if($Line =~ /\[\[(.*?)\]\]/){ $Name = $1; $Name =~ s/^.*\|//; }        elsif($Line =~ /\[(.*?)\]/){ $Name = $1; $Name =~ s/^.*?\s+//; } 		else{ $Name = $Line; } 		$Lines{lc($Name)} = $Line; } } foreach $Name(sort keys %Lines){ printf("* %s\n", $Lines{$Name}); }