in reply to How to find out a character position ?

my $pos_of_nl = rindex $str, "\n", 10-1;

(whether it's 10-1, 10-2 etc. depends on how exactly you're counting... feel free to finetune)

Replies are listed 'Best First'.
Re^2: How to find out a character position ?
by balakrishnan (Monk) on Feb 25, 2009 at 08:20 UTC
    It matches my need. Thanks.