Re: Variable naming
- From: claird@xxxxxxxxx (Cameron Laird)
- Date: Wed, 27 Sep 2006 21:45:50 +0000
In article <efep6g$8m9$1@xxxxxxxxxxxxx>,
Dario D. <dario.djuricNOSPAM@xxxxxxxxx> wrote:
Hello all,.
Is slash (/) allowed in variable names? I'm reading a tutorial on the
NS2 simulator, and it appears to be using slashes in class names:
set tcp [new Agent/TCP]
I tried to run the following example through tclsh, but as you can see
it didn't work out well:
% set test/blah 5
5
% puts $test/blah
can't read "test": no such variable
.
.
A. Tcl allows ANYTHING in a variable name. It even
allows nothing (an empty string--'turns out to be
useful occasionally)!
B. However, the rules for $-dereferencing are slightly
different. Try this:
set test/blah 5
puts ${test/blah}
.
- Prev by Date: Re: no irc in tcllib?
- Next by Date: Re: Why no central repository for tcl extensions?
- Previous by thread: Re: Variable naming
- Next by thread: Re: Variable naming
- Index(es):
Relevant Pages
|