perl to tcl? - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: perl to tcl? (/showthread.php?tid=50600)
perl to tcl? by rix on 09-17-2005 at 09:10 AM
Hey guys,
i have one Irssi script, based on C, but my bot uses TCL. Is it possible to convert script from C to TCL?
code: #!/usr/bin/perl
my $ch = shift;
my $n2ita = 0;
if ($ch eq "etv") {
$ch = 1;
$kanal = "ETV";
}
elsif ($ch eq "kanal2")
{
$ch = 2;
$kanal = "Kanal 2";
}
elsif ($ch eq "tv3")
{
$ch = 3;
$kanal = "TV 3";
}
else
{
print " Tundmatu kanal. Valikud on etv, kanal2, tv3\n";
exit 0;
}
my $url = "http://www.w3.ee/index.php?id=54";
my @page = `lynx -display_charset=UTF-8 -crawl -width=20000 -source $url | grep -A 6 header`;
foreach(@page) {
next if(/^\s*$/);
$n2ita = 1 if(/$ch/);
s/^\s*//;
s/<tr>/\n/g;
s/<\/tr>/\n/g;
# s/<[^>]*>/;/g;
# s/<.b>/;/g;
# s/<.td>/;/g;
# s/\s\s*/ /g;
s/ä/ä/g;
s/ü/ü/g;
s/Ã\//Ü/g;
s/õ/õ/g;
s/ÃU/Õ/g;
s/ö/ö/g;
s/ž/¸/g;
s/â/"/g;
s/õ/õ/g;
s/<[^>]*>/;/g;
s/Ã/Ü/g;
# s/^(.{389}).*$/\1.../;
# s/--//g;
push(@kava,$_);
}
$a = join(" ", @kava);
$a = substr($a, 4, -13);
@saade = split(/;/, "$a");
#print @kava;
if ($ch eq "1") {
print "Kanal: [" . $kanal ."] Saade: [" . @saade[35] . "] Algas: [" . @saade[32] . "] Kirjeldus: [" . @saade[37] . "] Aeg: [" . @saade[38] . "]\n";
}
elsif ($ch eq "2")
{
print "Kanal: [" . $kanal ."] Saade: [" . @saade[49] . "] Algas: [" . @saade[46] . "] Kirjeldus: [" . @saade[51] . "] Aeg: [" . @saade[52] . "]\n";
}
elsif ($ch eq "3")
{
print "Kanal: [" . $kanal ."] Saade: [" . @saade[63] . "] Algas: [" . @saade[60] . "] Kirjeldus: [" . @saade[65] . "] Aeg: [" . @saade[66] . "]\n";
}
#print @kava;
Or is there so kind people, who could write it into tcl? It takes on-air tv shows information from w3.ee site and privmsg it to user.
RE: C to tcl? by segosa on 09-17-2005 at 05:23 PM
That's perl.
I'd convert it, but I don't know TCL.
RE: perl to tcl? by rix on 09-18-2005 at 08:44 AM
That's sad. But script author said it's in C. I don't know anything about it...actually he mentioned perl.
Is there anybody who knows both perl & tcl?
|