Using env variables in tcl script

S

Soumen

Hi,

If I do following in tclsh prompt, it works;

%set i [array names env PATH]
%echo $env($i)

But if I wrap it in a.tcl, source it in tclsh prompt and call test, it
gives me following error:

can't read "env": no such variable

----------- a.tcl -----------------
proc test {} {
set i [array names env PATH]
echo $env($i)
}
--------------------------------------

%source a.tcl
%test
can't read "env": no such variable
%

Please let me know how to resolve this.

Regards,
~ Soumen
 
S

santosh

Soumen wrote:

<snip>

Please post to a TCL group or forum like comp.lang.tcl. This group is
for standard C. You might also try comp.programming.
 
M

Mark Bluemel

Soumen said:
Hi,

If I do following in tclsh prompt, it works;

%set i [array names env PATH]
%echo $env($i)

But if I wrap it in a.tcl, source it in tclsh prompt and call test, it
gives me following error:

can't read "env": no such variable

----------- a.tcl -----------------
proc test {} {
set i [array names env PATH]
echo $env($i)
}
--------------------------------------

%source a.tcl
%test
can't read "env": no such variable
%

Please let me know how to resolve this.

Would you like us to diagnose your car's timing problem as well?

This has nothing to do with C - why should we be expected to know
anything about it?

There appears to be a comp.lang.tcl group - why not ask there?
 
K

Kenny McCormack

Please let me know how to resolve this.

Would you like us to diagnose your car's timing problem as well?

This has nothing to do with C - why should we be expected to know
anything about it?[/QUOTE]

No, sorry, you are wrong. See, tcl is written in C, therefore this is
on topic in a C group.

See, ultimately, we all know that "tcl" is just a wrapper around the
underlying C runtime. For example, the error message that the OP
mentions - that actually comes from C.
There appears to be a comp.lang.tcl group - why not ask there?

Interesting. That might work, as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top