All pastes #211291 Raw Edit

morsedecode

public text v1 · immutable
#211291 ·published 2006-10-20 07:22 UTC
rendered paste body
#!/usr/bin/perl -w

use strict;

my %alphabet=(
	"a"=>".-",
	"b"=>"-...",
	"c"=>"-.-.",
	"d"=>"-..",
	"e"=>".",
	"f"=>"..-.",
	"g"=>"--.",
	"h"=>"....",
	"i"=>"..",
	"j"=>".---",
	"k"=>"-.-",
	"l"=>".-..",
	"m"=>"--",
	"n"=>"-.",
	"o"=>"---",
	"p"=>".--.",
	"q"=>"--.-",
	"r"=>".-.",
	"s"=>"...",
	"t"=>"-",
	"u"=>"..-",
	"v"=>"...-",
	"w"=>".--",
	"x"=>"-..-",
	"y"=>"-.--",
	"z"=>"--..",
	"0"=>"-----",
	"1"=>".----",
	"2"=>"..---",
	"3"=>"...--",
	"4"=>"....-",
	"5"=>".....",
	"6"=>"-....",
	"7"=>"--...",
	"8"=>"---..",
	"9"=>"----.",
	"FS"=>".-.-.-",
	","=>"--..--",
	"QRY"=>"..--.."
);

my ($one,@code,$key,$value);

open OUT, "+<out";
print OUT "\n";
while(<OUT>)
{
	@code=split/\s/;
	foreach $one(@code)
	{
		while(($key, $value)=each %alphabet)
		{
			if($one eq $value){ print OUT "$key";}
		}
	}
}
print OUT "\n";