I want to implement my own tweet compressor. Basically this does the following. However I'm stuck with some of the unicode issues.
Here's my script:
#!/usr/bin/env perl
use warnings;
use strict;
print tweet_compress('cc ms ns ps in ls fi fl ffl ffi iv ix vi oy ii xi nj/, "\. " ,", "'),"\n";
sub tweet_compress {
my $tweet = shift;
$tweet =~ s/\. ?$//;
my @orig = ( qw/cc ms ns ps in ls fi fl ffl ffi iv ix vi oy ii xi nj/, ". " ,", ");
my @new = qw/㏄ ㎳ ㎱ ㎰ ㏌ ʪ fi fl ffl ffi ⅳ ⅸ ⅵ ѹ ⅱ ⅺ nj . ,/;
$tweet =~ s/$orig[$_]/$new[$_]/g for 0 .. $#orig;
return $tweet;
}
But this prints junk out at the terminal:
?.?.?.?.?.?.?.f.?.f?.?.?.?.?.?.?.nj/."\..,"."
What am I doing wrong?