Re: strings in TcL



In article <1162204993.750517.229970@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
vlsi student <singirikonda@xxxxxxxxx> wrote:
hello every one

I have very small dought in TcL strings evaluation, i need to perform
soem function only IF conditions satifies . I am accessing line by line
from a file using fconfigure comand . The file has lines starting with
# and other with out hash and now i have to put all the lines start
ting with # in a list with out the #itslef and other lines in an other
variable for this .. i am using the following code

set fp [open new_file1 r]
fconfigure $fp -buffering line
gets $fp data
while {$data != ""} {
set data_1 [split $data ""]
if { [string compare [lindex $data_1 "0"] \#] ==0}
set k $data_1
set l [llength $k]
for {set j 1} {$j<=$l} {incr j}
append toi_1 [lindex $k $j]
}
lappend atoi $atoi_1
} else {
lappend atoi3 $data
}
gets $data
}
close

using this i am getting some strange results...

can soem one please suggest some other command so that i can compare #
with line and do the same

suresh


I don't understand the question. Is

[string match #* $data]

the answer?
.