Perl Monk, Perl Meditation | |
PerlMonks |
Re: Find maximum number in text file and copying its full statement in new text file?by kcott (Archbishop) |
on May 06, 2015 at 04:02 UTC ( [id://1125793]=note: print w/replies, xml ) | Need Help?? |
G'day sumathigokul, Your regex baffles me! You're trying to match (and capture) one or more digits immediately preceded by and followed with a colon — clearly not what you want. I'd recommend spending some time with the Perl Regular Expressions Tutorial. You have no code to output the wanted lines — which is why that part isn't working. Take a look at open; note how both of the initial examples (for reading and writing) use the 3-argument form and lexical filehandles; start doing this yourself. This code has the logic you need — you'll need to add the I/O:
Output:
-- Ken
In Section
Seekers of Perl Wisdom
|
|