in reply to Parse a File and get a value

Two mistakes:
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
prints:
!259! Name LUN 259
Aside: you only need to use code tags for your code and data, not for your question: Writeup Formatting Tips

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