We don't bite newbies here... much | |
PerlMonks |
Re: Find range in coordinates arrayby choroba (Cardinal) |
on Sep 30, 2019 at 18:58 UTC ( [id://11106887]=note: print w/replies, xml ) | Need Help?? |
Tk::Text returns indices, not coordinates. The number before the dot is the line, the number after the dot is the character. In this respect, the indices are similar to v-strings (v7.23 lt v7.133). You need to do the comparison yourself:
This is suboptimal as the input is split again for each comparison. It might be better to store tuples instead of strings, i.e. convert on input to tuples and convert back to indices on output. Note that I used strings to store the indices to avoid imprecise floating point arithmetic.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|