in reply to Re^2: execute vbscript code inline in Perl script
in thread execute vbscript code inline in Perl script

If I echo in vbs, this value didn't store into Perl.

Dim num1, num2, final, str num1 = 30 num2 = 50 str = "Final Value: " final = num1*num2 'MSGBOX str & final 'WScript.Quit(final) Wscript.Echo final

my $final = qx("cscript out2.vbs"); print STDOUT "Final: --> $final\n";

Final: --> Microsoft (R) Windows Script Host Version 5.8

Copyright (C) Microsoft Corporation. All rights reserved.

1500

Replies are listed 'Best First'.
Re^4: execute vbscript code inline in Perl script
by poj (Abbot) on Sep 08, 2017 at 16:59 UTC

    Try

    #!perl use strict; my $final = qx("cscript out2.vbs //NoLogo"); print "Final: --> $final\n"
    poj
      ++poj: by the time I had my reply typed, you'd already posted. :-( My only additional recommendation would be to chomp($final), or chomp(my $final = qx("cscript out2.vbs //Nologo"));, so that slick.user doesn't have a surprise newline in $final.
        That's look good! Thank you!