- Introduction
- Running Tcl
- Simple Text Output
- Assigning values to variables
- Evaluation & Substitutions 1: Grouping arguments with “”
- Evaluation & Substitutions 2: Grouping arguments with {}
- Evaluation & Substitutions 3: Grouping arguments with []
- Results of a command – Math 101
- Computers and Numbers
- Numeric Comparisons 101 – if
- Textual Comparison – switch
- Looping 101 – While loop
- Looping 102 – For and incr
- Adding new commands to Tcl – proc
- Variations in proc arguments and return values
- Variable scope – global and upvar
- Tcl Data Structures 101 – The list
- Adding & Deleting members of a list
- More list commands – lsearch, lsort, lrange
- Simple pattern matching – “globbing”
- String Subcommands – length index range
- String comparisons – compare match first last wordend
- Modifying Strings – tolower, toupper, trim, format
- Regular Expressions 101
- More Examples Of Regular Expressions
- More Quoting Hell – Regular Expressions 102
- Associative Arrays
- More On Arrays – Iterating and use in procedures
- Dictionaries
- File Access 101
- Information about Files – file, glob
- Invoking Subprocesses from Tcl – exec, open
- Learning the existence of commands and
9 Comments
hiAndrewQuinn
I like Tcl a lot, especially the Expect module. If you've ever wanted an Autohotkey for your terminal (I promise that phrase actually makes sense) it's well worth your time to look into either Expect itself or Python's `pexpect` module.
zerr
I skipped Tcl in favor of Perl. Is there any reason to reconsider nowadays?
watersb
The once-ubiquitous open-source package manager for macOS, MacPorts, is basically a Tcl app.
That is to say, its packages are Tcl.
I haven't used it in many years, as is has been largely replaced by Homebrew, which uses Ruby.
(I once maintained a MacOS port of a good-sized scientific analysis package. Hundreds of MacPorts packages, I have debugged.)
https://www.macports.org/
antirez
If you want to play with reading/recreating a very small Tcl interpreter, recently I put Picol (a 500 lines of C code Tcl interpreter) on Github. It was still on the web, but a bit more "hidden". I had a chance to re-read the code, and it is not in the category of code I regret writing :D Still relatively useful for newcomers, I hope.
https://github.com/antirez/picol
WillAdams
Wait, didn't Tcl/TK 9 just launch?
https://www.tcl-lang.com/software/tcltk/9.0.html
Any word on a nice binary release of it?
kras143
Tcl offers a unique combination of embeddability and power, often underappreciated outside specific domains. While its general-purpose usage might be less prominent, its dominance in Electronic Design Automation (EDA) is undeniable.
ChipsNDip
Nice, a TCL post!
I use TCL often (forced to) since it's Cloverleaf Integration Engine's official scripting language and it works very well, but it is different from other languages in that its syntax is not modern, though, it's not difficult to learn if you really need to.
It's an older language that's fallen out of favor mostly for other scripting languages (Javascript, Python, etc) and understandably so. I'm by no means an TCL, but do consider myself an expert when using it with Cloverleaf.
Thanks!
twothamendment
I haven't used TCL in a few decades and I don't miss it, but that is likely due to running it on storyserver. Worst web platform ever.
hieloz
Nice. Tcl scripts are widely used in wireless communication,especially base station testing.