in reply to Re: system & shell metacharacters
in thread system & shell metacharacters

I'm with you. I'd use something like
open BAR, '|bar.pl' || die qq(Useful msg: $!); print BAR $xmldata;
and let bar.pl read from STDIN. No shell at all. OP might want a glance at perlipc.

Replies are listed 'Best First'.
Re: Re: Re: system & shell metacharacters
by bunnyman (Hermit) on Jul 23, 2003 at 15:58 UTC
    open BAR, '|bar.pl' || die qq(Useful msg: $!);

    ... is wrong, because it is interpreted as:

    open BAR, ('|bar.pl' || die qq(Useful msg: $!));

    ... so remember to use "or die" rather than "|| die".

      Really? Ya learn something new every day :) I have a great number of scripts to modify, it would seem....
        Using || die is fine as long as parens are used.
        open(FOO, $file) || die "Couldn't open $file - $!\n";

        When no parens are present, you should use or die instead.

        Personally, I always use parens everywhere so my code is littered with || dies.

        -- vek --