in reply to help printing items across multiple lines

Here is a solution that does not use the Range Operator:
use strict; use warnings; my $name; while (<DATA>) { if (/^.*Pseudo.*?\=(.*?$)/) { $name = $1 } if (/^.*Logical.*?\=(.{4})/sg) { print "$name,$1\n" } } __DATA__ Pseudo name=hdiskpower97 Symmetrix ID=000187751303 Logical device ID=0380 state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ====================================================================== +======== ---------------- Host --------------- - Stor - -- I/O Path - -- S +tats --- ### HW Path I/O Paths Interf. Mode State Q-IO +s Errors ====================================================================== +======== 0 fscsi0 hdisk100 FA 10cA active alive +0 0 2 fscsi2 hdisk254 FA 7cA active alive +0 0 Pseudo name=hdiskpower90 Symmetrix ID=000187751303 Logical device ID=0381 state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ====================================================================== +======== ---------------- Host --------------- - Stor - -- I/O Path - -- S +tats --- ### HW Path I/O Paths Interf. Mode State Q-IO +s Errors ====================================================================== +======== 2 fscsi2 hdisk247 FA 7cA active alive +0 0 0 fscsi0 hdisk93 FA 10cA active alive +0 0

prints:

hdiskpower97,0380 hdiskpower90,0381