Eu fiz a mesma pergunta e criei esta como primeiro passo:
#! /usr/bin/perl
use strict;
use warnings;
my $filename = 'hwinfo_example.txt';
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
while (my $row = <$fh>) {
chomp $row;
if( index($row, ' Chassis Info') eq 0 ){
#print "$row\n";
while (my $row = <$fh>){
chomp $row;
if( (length($row) < 5) or (substr($row, 2, 1) ne ' ') ){
last ;
}
if( index($row, ' Serial:') eq 0 ){
print "$row\n";
}
}
}
}