use strict; use warnings; my %unitMap; my $skipNext; my $cmd = "hpacucli ctrl slot=0 pd all show"; open my $fd, "$cmd|"; while (my $row = <$fd>) { $row =~ /^$/ and next; $row =~ s/[,|)|(]//g; chomp $row; next if $row =~ /^Smart/g; $row =~ s/^\s+//; if( $row =~ /^unassigned/ ){ $skipNext = 2; next; print "$row\n"; } close($fd);