in reply to Unix system commands to Perl

It's beyond me why you want to replace one line of code with 5 lines of code (and you're going to use an external program anyway....), but here it is:
open my $fh => $file or die "Failed to open $file: $!\n"; open my $mh => "| mailx -s 'Title' email" or die "Failed to open pipe: + $!\n"; print $mh $_ while <$fh>; close $mh or die "Failed to close pipe: $!\n"; close $fh or die "Failed to close $file: $!\n";

With open STDERR, "/dev/null" you open the handle for reading. Try opening it for writing, using open STDERR, "> /dev/null"

Abigail

Replies are listed 'Best First'.
Re: Re: Unix system commands to Perl
by Anonymous Monk on Jul 09, 2002 at 18:43 UTC
    Thank you.