Help for this page

Select Code to Download


  1. or download this
    ...
        my $len = pos($string) - $newlines[-1];
        push @newlines, [ pos($string), $len ];
    ...
    
  2. or download this
    my $avg_len = 0;
    $avg_len = length($string) / 0+@newlines;
    
    my $estimated_line = int( $position / $avg_len );