Re: portable /dev/null ?



Larry schrieb:

On Jun 29, 11:03 am, "Jürgen Exner" <jurge...@xxxxxxxxxxx> wrote:

Larry wrote:

I want to run an external command using "system" but discard its
standard output. I know under *nix I could do:

system 'myCmd > /dev/null';

and Windows:

system 'myCmd > nul';

but is there a more portable way to do that?

Maybe you're looking for File::Spec->devnull() ?


If you would drop your requirement of using system(), then you could use
backticks and capture (and then discard) the output in your Perl program.

jue


I thought of the backticks method, but I remember that being a problem
in Windows the last time i tried it.

perl -e "print `echo foo > nul`"
works fine here.

HTH,
Andreas Pürzer
--
Have Fun,
and if you can't have fun,
have someone else's fun.
The Beautiful South
.