Hacker News new | past | comments | ask | show | jobs | submit login

I spend a lot of time using Tcl (I have to) and I spend almost as much time wishing I could be using Perl instead. This is partly because of weirdness, as described by the author of this article, and partly because I routinely run into things that seem to be far more difficult to do in Tcl, than they ever would be in Perl.

Can I get one of the Tcl adherents in this thread to comment- have I got things completely wrong? Need I simply become better with Tcl? Or does it truly lack things like powerful string handling and hash tables?




For hash tables you have two options: the dictionary[1] or the Tcl array[2], which is more or less like an Awk array.

Can you give me an example of powerful string handling?

string[3] for the usual string manipulations.

subst[4] when you want weird string substitutions (works like a template).

regsub[5] and regexp[6] for regular expressions.

[1] http://www.tcl.tk/man/tcl/TclCmd/dict.htm

[2] http://www.tcl.tk/man/tcl/TclCmd/array.htm

[3] http://www.tcl.tk/man/tcl/TclCmd/string.htm

[4] http://www.tcl.tk/man/tcl/TclCmd/subst.htm

[5] http://www.tcl.tk/man/tcl/TclCmd/regsub.htm

[6] http://www.tcl.tk/man/tcl/TclCmd/regexp.htm


Tcl most certainly does have hash tables--Tcl arrays are implemented as hashes and can have arbitrary keys.


Depending upon what you do, you could be using Perl, with the help from the Tkx (for GUIs) or Tcl (for about everything else) CPAN modules and use TCL liberally from within Perl.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: