in reply to Re: Finding length of line if have any position of any char inside line
in thread Finding length of line if have any position of any char inside line
But the following gives no result even though the
"\nwant length of this line\n"
substring containing a character at offset 12 in the overall string matches the /\n.*(?=\n)/ regex:
c:\@Work\Perl\monks>perl -wMstrict -le "my $string = qq{test\nI\nwant length of this line\n test}; my $position = 12; ;; my $length_of_line; if ( $string =~ /\n.*(?=\n)/ && $-[ 0 ] < $position && $+[ 0 ] > $pos +ition ) { $length_of_line = $+[ 0 ] - $-[ 0 ]; } print $length_of_line; " Use of uninitialized value in print at -e line 1.
Give a man a fish: <%-{-{-{-<
|
|---|