Can't get element of array
From: Alexander Danilov (alex_at_fssg.st-oskol.ru)
Date: 07/25/04
- Next message: John Culleton: "Newbie question"
- Previous message: Michael Schlenker: "Re: XML document"
- Next in thread: Benjamin Riefenstahl: "Re: Can't get element of array"
- Reply: Benjamin Riefenstahl: "Re: Can't get element of array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 25 Jul 2004 16:52:47 +0400
Help please.
I can't find rational explanation of the following error:
---------cut here------------
extension example => 9849
iMap: an indexed map viewer => 8771
If we had no proc => 5892
NSIface => 5354
) => 991
Randy Kunkee => 1828
* => 4255
can't read "t(+)": no such element in array
while executing
"set a $t($name)"
("foreach" body line 2)
invoked from within
"foreach name [array names t] {
set a $t($name)
puts "$name => $a"
if {[llength $a] == 1} {
array unset t $name
}
}"
(file "./demo.tcl" line 18)
---------cut here------------
during runing the folowing script:
---------cut here------------
#! /bin/sh
# \
exec tclsh "$0" "$@"
package require Mk4tcl
mk::file open wiki wikit.tkd -readonly
array set t {}
foreach i [mk::select wiki.pages] {
set name [mk::get wiki.pages!$i name]
lappend t($name) $i
}
#parray t
puts "-------------------------------------"
foreach name [array names t] {
set a $t($name)
puts "$name => $a"
if {[llength $a] == 1} {
array unset t $name
}
}
puts "-------------------------------------"
puts [array get t]
---------cut here------------
I can't understand why I can't get element with index "+".
I am absolutely sure, than array "t" has element with index "+"
(uncomment parray t).
Is it bug in Tcl?
wikit.tkd - it's a local copy of Tcl Wiki
P.S.: OS - Debian Linux v3.0 (woody), Tcl v8.4.6, Mk4tcl v2.4.9.3
- Next message: John Culleton: "Newbie question"
- Previous message: Michael Schlenker: "Re: XML document"
- Next in thread: Benjamin Riefenstahl: "Re: Can't get element of array"
- Reply: Benjamin Riefenstahl: "Re: Can't get element of array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|