I just realized, that
lsearch -real -index 0 {0 1.0} 1.00
does not find the 1.0 element in the given list!
Same for:
lsearch -real -index 0 {0 1.0} 1
Why is that???
Since "expr 1.0==1.00" and "expr 1.0==1" return true, I realy wonder...
Any explanation for this behavior?
lsearch -real -index 0 {0 1.0} 1.00
does not find the 1.0 element in the given list!
Any explanation for this behavior?
On 17/09/2025 16:19, meshparts wrote:
lsearch -real -index 0 {0 1.0} 1.00[snip]>
does not find the 1.0 element in the given list!
Any explanation for this behavior?
The matching style for lsearch defaults to -glob. The -real option is
only meaningful when used with the -exact option. And then it works as expected:
% lsearch -exact -real {0 1.0} 1.00
1
% lsearch -exact -real {0 1.0} 1
1
I concede that it would make sense for the -real option (and a few other options) to imply -exact.
Schelte
The matching style for lsearch defaults to -glob. The -real option is
only meaningful when used with the -exact option. And then it works as expected:
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (1 / 5) |
| Uptime: | 23:38:07 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
6 files (8,794K bytes) |
| Messages: | 186,852 |
| Posted today: | 1 |