Without seeing the rest of your code and not really sure what value the widget ( $t->index('insert') ) is actually returning, you said '2.0'... Since I am not sure what widget you are using... I would maybe try qq/ $t->index('insert')/ or $t->index('insert').""... since perl may be trying to cast the index into a number instead of leaving it as a string
The following works for me on AS 5.8.3 build 809 and Tk 804.021:
use Tk;
use strict;
my $mw = tkinit;
$mw->geometry('100x100');
my $linenumbers = $mw->Text()->pack(-fill, 'both', -expand, 1);
&line_num(30);
MainLoop;
sub line_num {
my $total_lines = shift;
#my $line_number = qq($t->index('insert')); #?
my $line_number = '21.0';
print $line_number,"\n";
$linenumbers->delete("0.1", "end");
for (0..$total_lines) {
$linenumbers->insert('end', join "\n", map {sprintf "%4d\n", $_
+} $_);
}
#$linenumbers->yviewMoveto($line_number/$total_lines);
#$linenumbers->yview(-pickplace, $line_number);
$linenumbers->see($line_number);
}
JamesNC