in reply to Re: Formatting Long String in Backticks
in thread Formatting Long String in Backticks

I am trying to avoid to do what you just did. If this can be written elegantly like this.
my $cmd = qq! testing testing ! . qq! ... testing testing !;
then why can't this code be re-written elegantly as well?
my $test = qx! testing testing ! . qx! ... testing !;
There must be a way to write the qx where I do not need to use $cmd anymore.

Replies are listed 'Best First'.
Re^3: Formatting Long String in Backticks
by rovf (Priest) on Mar 10, 2010 at 08:58 UTC
    then why can't this code be re-written elegantly as well?
    Because the dot (.) is defined as catenating strings. Hence,

    qx(a).qx(b)
    is valid, but is defined as catenating the result of qx(a) and the result of qx(b), which is of course different from qx(a b).

    -- 
    Ronald Fischer <ynnor@mm.st>
Re^3: Formatting Long String in Backticks
by AnomalousMonk (Archbishop) on Mar 10, 2010 at 00:11 UTC

    Stupid Array Interpolation Trick #158:

    >perl -wMstrict -le "my $test = qx{ @{[ qw(echo testing ...)[0, 1, 1, 1, 2, 1] ]} }; print qq{'$test'}; " 'testing testing testing ... testing '