tags:

views:

261

answers:

1

I'm learning Tcl. In Perl I can do this:

 $ perl -e 'for ($i = 0; $i < 5; $i++) { printf("name%03d\n", $i) }'
 name000
 name001
 name002
 name003
 name004

Can I do this in Tcl?

+11  A: 

See format:

$ tclsh
% for {set i 0} {$i < 5} {incr i} { puts [format "name%03d" $i] }
name000
name001
name002
name003
name004
Sinan Ünür
Thank you! That works.
grokus