Interleaved lists and associative arrays
- From: "Jingzhao Ou" <jingzhao.ou@xxxxxxxxx>
- Date: 14 Mar 2007 10:42:29 -0700
Hi, all,
I need write Tcl code to interactive with a Perl module. Perl may pass
me something like the following::
{
[
{ url => 'http://foo.org', title => 'The Foo Organsiation' }
{ url => 'http://bar.org', title => 'The Bar Organsiation' }
],
[
{ url => 'http://foo.org', title => 'The Foo Organsiation' }
{ url => 'http://bar.org', title => 'The Bar Organsiation' }
]
}
[] is equivalent to the Tcl list. However, I cannot find the Tcl
equivalence for {} (associative arrays). I know that Tcl has array
variables, which implement associative arrays. But it seems that array
variables cannot be embedded into a Tcl list. See the following
example:
% set webpage1(url) http://foo.org
http://foo.org
% set webpage1(title) http://foo.org
http://foo.org
% [list $webpage1]
can't read "webpage1": variable is array
Can any one shed some light on this problem? I am kind of stuck right
now.
Thanks a lot!
Best regards,
Jingzhao
.
- Follow-Ups:
- Re: Interleaved lists and associative arrays
- From: suchenwi
- Re: Interleaved lists and associative arrays
- Prev by Date: Decoding CJK characters to unicode in Tcl
- Next by Date: Hang on application close when using 'socket -server ...'
- Previous by thread: Decoding CJK characters to unicode in Tcl
- Next by thread: Re: Interleaved lists and associative arrays
- Index(es):
Relevant Pages
|