if ( $array =~ /^\s*$/ ) { # true if line is empty or whitespace only
....
}
####
(echo SYSDATAMSG; uname -a; uptime; date) | mail -s uptime time@taproot.bz
####
open(MAIL, "$file") || die "cant open spool\n";
my @mail_lines = ;
close (MAIL);
while ( @mail_lines ) {
$_ = shift @mail_lines;
if ( /^SYSDATAMSG$/ ) { # next three lines are needed
$uname_data = shift @mail_lines;
$uptime_data = shift @mail_lines;
$time_stamp = shift @mail_lines;
# (maybe you want to do things with those lines before/besides printing)
print $uname_data, $uptime_data, $time_stamp;
}
}