in reply to Parsing a Large file with no reason

This will extract the id & label from each block much more quickly than your code, by reading one block at a time. I didn't understand your hash, so I've left that to you.

#! perl -slw use strict; use Data::Dump qw[ pp ]; $/ = "\n----"; ## read 1 multiline record at a time while( <DATA> ) { my( $label, $id ) = m[ -El \s+ (\S+) .+? serial_id \s+ ( \S+ ) ]xms or die 'Bad data'; print "$label : $id"; } __DATA__ ---- lsattr -El vgbkup ---- auto_on y N/A True conc_auto_on n N/A True conc_capable n N/A True gbl_pbufs_ppv 0 N/A True gbl_pbufs_pvg 0 N/A True timestamp 49188ced308665bd N/A True vg_pbufs_ppv 0 N/A True vgserial_id 00c0b42000004c000000011a5f8b013e N/A False ---- lsattr -El vgfrd01 ---- auto_on y N/A True conc_auto_on n N/A True conc_capable n N/A True gbl_pbufs_ppv 0 N/A True gbl_pbufs_pvg 0 N/A True timestamp 4ae7197814a6d91a N/A True vg_pbufs_ppv 0 N/A True vgserial_id 00c0b42000004c000000011a0d27a4bc N/A False ---- lsattr -El loglv02 ---- copies 1 N/A True inter m N/A True intra m N/A True label None N/A True lvserial_id 00c0b42000004c000000011a5f8b013e.2 N/A False relocatable y N/A True size 1 N/A True strictness y N/A True stripe_size N/A True stripe_width 0 N/A True type jfs2log N/A True upperbound 64 N/A True ---- lsattr -El lvbackup ---- copies 1 N/A True inter x N/A True intra im N/A True label /backup N/A True lvserial_id 00c0b42000004c000000011a5f8b013e.1 N/A False relocatable y N/A True size 1200 N/A True strictness y N/A True stripe_size N/A True stripe_width 0 N/A True type jfs2 N/A True upperbound 64 N/A True

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"