in reply to qw "$string $string" doesn't interpolate

In fact, it made me wonder if this DWIM:
my @option_config = qw" $UNIQUE_OPT
                        $FORCE_OPT
                        $VERBOSE_OPT
                        $OUTPUT_EXT_OPT=s
                      ";
:( Sadly, it doesn't.
Have you checked to see if
my @option_config = q" $UNIQUE_OPT $FORCE_OPT $VERBOSE_OPT $OUTPUT_EXT_OPT=s ";
interpolates? :)

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: qw "$string $string" doesn't interpolate
by QM (Parson) on Jun 12, 2004 at 15:20 UTC
    Have you checked to see if
    my @option_config = q" $UNIQUE_OPT $FORCE_OPT $VERBOSE_OPT $OUTPUT_EXT_OPT=s ";
    No, but doing so shows me that @option_config is equivalent to:
    [ ' $UNIQUE_OPT $FORCE_OPT $VERBOSE_OPT $OUTPUT_EXT_OPT=s ' ]
    a single element array, complete with the newlines and leading whitespace. Not DWIM.

    I'm not sure what your point was...Should q"" interpolate or not? I would suggest it should not, because that would be confusing. But I could live with the argument that it should, because then the behavior of double-quotish strings would be consistent.

    On the 3rd hand, things like s"$foo"$bar" behave differently from s'$foo'$bar':

    $foo = 'foo'; $bar = 'bar'; $football = 'football'; ($x = $football) =~ s"$foo"$bar"; # $x eq 'bartball' ($x = $football) =~ s'$foo'$bar'; # $x eq 'football' (no change)
    My point is, qw is not apparently single-quotish in nature, but it would DWIM to have it double-quotish using double quotes, as with other operators.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      ...Not DWIM.

      I'm not sure what your point was...Should q"" interpolate or not?

      You need to stop saying DWIM. Of course q"" should not interpolate because that's now how the quoting operators work. The quoting operators allow you to use alternate delimiters so you can get the benefits of ' (no interpolation, q) and " (interpolation, qq) without the need to escape ' and " in the strings.
      On the 3rd hand, things like s"$foo"$bar" behave differently from s'$foo'$bar',... My point is, qw is not apparently single-quotish in nature, but it would DWIM to have it double-quotish using double quotes, as with other operators.
      qw is single-quotish in nature (a quoting operator which doesn't interpolate). s and m are not quoting operators, they are "Regexp Quote-Like Operators".

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.