Re: Perl qx// broken with OpenVMS 8.x



In article <1159446885.659982.286700@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
yyyc186@xxxxxxxxxx wrote:

perl -e "$x = qx/@test/; print $x;"

Dead

type test.com
$ write sys$output "This is a test"

perl -e "$x = qx/type test.com/; print $x;"
$ write sys$output "This is a test"

@test
This is a test

Prior to the upgrade, this used to work.

I doubt it. You are interpolating an array named @test and then
sending its contents to lib$spawn as a command string. Since the array
has never been initialized, of course there is no command to be
executed. If you enable warnings with the -w switch, the tool actually
lets you know what mistake you are making:

$ perl -we "$x = qx/@test/; print $x;"
Possible unintended interpolation of @test in string at -e line 1.
Name "main::test" used only once: possible typo at -e line 1.

If you don't want interpolation to take place so that DCL sees the '@',
there are a couple of easy ways to do that. One is to escape the '@':

$ perl -we "$x = qx/\@test/; print $x;"
This is a test

The other is to use single quotes for your quote delimiter, which get
special handling by the qx operator so no interpolation takes place:

$ perl -we "$x = qx'@test'; print $x;"
This is a test

In your original example, you were interpolating @ARGV, i.e., the
program's command-line arguments, in the qx operator, which I assumed
was your intention. In that case, interpolation is most likely what you
do want, but might be a clue. If you ran the program without passing
any
arguments, then the subprocess would not have anything to do, much like
when @test is interpolated above. That's one guess about what might be
causing your problem.

It's remotely possible that something in your recent upgrade triggered
a problem with your Perl script, but I still see no evidence that there
is something generally wrong with the qx operator.

--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: interpolation question
    ... Basically, I have a matrix, meanThickness =. ... I interpolated this using the following command: ... I wanted to check the accuracy of the interpolation. ... interp.m in MATLAB. ...
    (comp.soft-sys.matlab)
  • interpolation question
    ... Basically, I have a matrix, meanThickness =. ... I interpolated this using the following command: ... meanThicknessInterpolated with dimensions as expected. ... I wanted to check the accuracy of the interpolation. ...
    (comp.soft-sys.matlab)
  • Re: Posting Usenet News Messages
    ... > Consider using single quotes unless you are going to actually ... namely interpolation and backslash escapes. ... Given that the backslashes are there and there's nothing ... No, it's not a lie. ...
    (comp.lang.perl.misc)
  • Re: heredoc and array problems
    ... When you echo an array variable such as $Din SINGLE QUOTES ... you need to concatenate it as single quotes means a string literal ... So the implied interpolation works only inside strings. ...
    (comp.lang.php)
  • Re: Banging head against the wall..
    ... I'd try single quotes - maybe you've getting some sort of variable ... I just need another set of eyes on this as I cannot see ...
    (comp.lang.ruby)