3 ms·
My favorite Tcl trick is a single-line template file processing system. puts [ subst [ read [ open [ lindex $argv 0 ] ] ] ] (Hint: `subst` applies Tcl's
by bdowling 6y ago
My favorite Tcl trick is a single-line template file processing system.
puts [ subst [ read [ open [ lindex $argv 0 ] ] ] ]
(Hint: `subst` applies Tcl's string substitution function, which substitutes variables like $varname and Tcl commands enclosed in square brackets. So, this one line program can be used as a templating system that is somewhat like PHP or eRuby.)