my $file = 'mailmessage'; open( my $fh, $file ) or die "couldn't read file - $!"; my $mailContents = <$fh>; close( $fh );