in reply to Re^3: extracting value in a string after checking value after colon ':'
in thread extracting value in a string after checking value after colon ':'

How are you reading the lines from the file ?

#!/usr/bin/perl use strict; use warnings; my $infile = 'infile.txt'; open my $fh,'<',$infile or die "Could not open $infile : $!"; my $lineno = 0; while (<$fh>){ ++$lineno; if (/^ node \s+ (\d+) \s+ \w+ : $ /x){ print "lineno $lineno : $1\n"; } } close $fh; print "$lineno lines read from $infile\n";
poj
  • Comment on Re^4: extracting value in a string after checking value after colon ':'
  • Download Code