open $cb,"<","/tmp/cb.txt"; #- whole conversation into one string my $slurp=do {local $/,<$cb>};
#- split into single chats
my @chatters=split /^\s*$/m, $slurp;
for my $chat (reverse @chatters) {
my (undef,$head,@text)=split /\n/m, $chat;
#- print head
my ($date,$time,$author)=split /\s+/,$head;
print "", "[[$author]] $time", "
\n";
#- /me text to italic
if ($text[0]=~s/^\/me/[$author]/){
unshift @text,'';
push @text,'';
}
#- named links
for (@text){
s# (\w+) \( (http://.*?) \) #[$2|$1]#xg
}
#- print text
print join "\n",@text;
#- print separator
print "\n
\n\n"; }