Sujet : Re: Proper way to split a string?
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tclDate : 17. Dec 2024, 06:05:04
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjr0q0$1i1a9$4@dont-email.me>
References : 1
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Luc <
luc@sep.invalid> wrote:
As unlikely as that is, I ask of you: what is the wise, serious,
professional way of handling that situation and making sure that
worse things won't happen at sea?
If you really want both pieces in the same variable then use a proper
list:
bind $::SRw <Return> {set ::PINPUT [list $pname $pfile]}
Then you can access each piece with lindex 0 or lindex 1 (depending
upon which you want at the time) and Tcl will take care of making sure
the two pieces remain separate pieces.
Otherwise, just store them away as two separate variables:
bind $::SRw <Return> {
set ::PINPUT_name $pname
set ::PINPUT_file $pfile
}
Note, your example will likely not work because when the <Return>
binding runs, $pname and $pfile will not be variables in the global
scope, so adjust accordingly.