in reply to Parse a File and get a value
prints:use warnings; use strict; while (<DATA>) { if (/Name\s+LUN\s+(\d+)/){ my $lunid = $1; print "\n!$lunid!\n"; print $_; exit; } } __DATA__ Total Hard Errors: 0 Total Soft Errors: 0 Total Queue Length: 0 Name LUN 259 Minimum latency reads N/A
Aside: you only need to use code tags for your code and data, not for your question: Writeup Formatting Tips!259! Name LUN 259
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parse a File and get a value
by xossa (Initiate) on Nov 09, 2011 at 22:08 UTC | |
by choroba (Cardinal) on Nov 10, 2011 at 12:02 UTC |