#!/usr/bin/perl -w use strict; use diagnostics; use warnings; open(FIN,"< /opt/autotree/autouser/out/chk_cal_date.out") or die $!; my $old_ifs=$/; # Lets nullify the IRS. $/=undef; my $slurp=; $/=$old_ifs; # Restore the IFS close FIN; send_the_mail('you@there.com','a subject',$slurp); exit(0); sub send_the_mail { my($addr,$subject,$body)=@_; open(PIPE,sprintf("| mailx -s %s %s",$subject,$addr)) or die $!; print $body; close PIPE; } __END__