#!/usr/bin/perl -w use strict; while (<DATA>) { print "$. $_"; # $. is current line number } =prints 1 some line 1 2 some line 2 3 some line 3 =cut __DATA__ some line 1 some line 2 some line 3
In reply to Re: Returning line numbers of a string
by Marshall
in thread Returning line numbers of a string
by pts491
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |