is it somehow possible - while slurping a file - to still keep track of
the line numbers?
something like:

#!/usr/bin/perl -w

my $file = "1.txt";
# 11 - line number 1 
# 22 - line number 2 
# 55 - line number 3 
# 77 - line number 4 

open FILE, $file or die $!;
local $/;
$txt = <FILE>;

if ($txt =~ /55$/m) {
        print  $.;
        # should print 3
}

thank allan

Reply via email to