in reply to Multiple line records from a command string

Here is my approach, not using complex regular expressions. Stuff all colon-separated lines into a hash. When a new start-of-record is encountered, print out what you want from the hash, then clear the hash. This operates line-by-line, and only one record is in memory at a time.
use strict; use warnings; my %data; while (<DATA>) { if (/Symmetrix ID:/) { # start of new record print_record(%data) if %data; %data = (); } elsif (/:/) { chomp; my ($k, $v) = split /\s*:\s*/; $k =~ s/^\s+//; $data{$k} = $v; } } print_record(%data) if %data; sub print_record { my (%data) = @_; my @params = ( 'Device Serial ID', 'Vendor ID', ); for (@params) { print "$_: $data{$_}\n"; } print "\n"; } __DATA__
Prints for 2 records:
Device Serial ID: 6000062081 Vendor ID: EMC Device Serial ID: 6000062082 Vendor ID: EMC2