in reply to Re: perl equiv to cmd start
in thread perl equiv to cmd start

I did not abandon the post you read, Just a poorly typed previous post. As Im new to this forum, Im having trouble navigating its functions. Add to it Im having a head banging day with perl...

I did remember that, vaguely, and thank you.

Ultimately got it sorted out!

$mylaunch="START \"\" \"$myexe\" \"$myfile\""; exec("$mylaunch");

Replies are listed 'Best First'.
Re^3: perl equiv to cmd start
by soonix (Chancellor) on Jan 18, 2017 at 13:49 UTC
    to avoid backslash-orgies like this, you might be interested in the qq function operator. The corresponding entry in perlfunc is a bit terse, but see perlop under Quote and Quote like Operators. The nice thing about it is that you can choose the delimiter that you want
    Non-bracketing delimiters use the same character fore and aft, but the four sorts of ASCII brackets (round, angle, square, curly) all nest
    Your solution could then mutate to e.g.
    $mylaunch = qq !START "" "$myexe" "$myfile"! ; exec("$mylaunch");
    (as with "normal" functions, you are allowed to have whitespace between function name and opening delimiter)

      Hi soonix,

      the qq function

      I know I'm probably being overly pedantic, but I AFAIK qq and related (q, qw, qx, etc.) aren't functions, they're operators. For example, I can't replace the parens around function arguments with other characters, as I can in qx# echo foo #. I also can't call a function with a syntax like foo(a b c) as I can with qw(a b c). (In fact, for a while now I've explicitly been avoiding parens on qw and friends to disambiguate.)

      Regards,
      -- Hauke D

        Yes, I hesitated to call them functions, but as they (qq, etcetera) are listed in perlfunc, I did ;-)