#!/usr/bin/perl -w use strict; my $mailspoolfile = "/var/spool/mail/mohadib"; open MAIL, "< $mailspoolfile" or die "Error opening $mailspoolfile: $!\n"; # first, get (and discard) the headers, # which are in the first "paragraph": my $headers = do { local $/ = ""; }; # now read the remaining lines as normal. my( $uname, $uptime, $date ) = ; close MAIL; # don't forget to chomp! chomp $uname, $uptime, $date; # now you can print them if you want: print <