Created
July 20, 2012 07:06
-
-
Save endreszabo/3149194 to your computer and use it in GitHub Desktop.
unicode output dramatic script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# in irssi you can set off this with /exec -o irc-dramatic.pl <o hai der> | |
use strict; | |
use warnings; | |
use Encode qw/decode/; | |
binmode(*STDOUT, ":utf8"); | |
$|=1; | |
my @a=(0x3000,0xff01,0x201d,0xff03..0xff06,0x2019,0xff08..0xff0c,0x2212,0xff0e..0xff5d,0x301c,0xffe5,0xffe2); | |
sub dramatic($) { | |
return decode("UCS2-LE",join("",map{pack("v",$a[ord($_)-32])}split//,shift)) | |
} | |
sub drama($) { | |
$_=shift; | |
printf("%s\n", dramatic($_)); | |
printf("%s\n", dramatic(uc)); | |
printf("%s\n", join" ",split //,dramatic(uc)); #single wide space OR | |
# printf("%s\n", dramatic(join" ",split //,uc)); #double wide space | |
} | |
if ($#ARGV>=0) { | |
drama join" ",@ARGV; | |
} else { | |
while(<>) { | |
drama chomp; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment