wrote:
> Henry Law <> wrote:
>
>
>> $WScript->Echo($arg->Item($i));
>> #print OUTPUT "$arg->Item($i)\n";
>
> ....
>
>>Can anyone help me find out why replacing this "Echo" thing with a print
>>statement apparently changes the data printed? I'm mystified.
>
>
> It is not because you changed print to Echo, it is because in the
> process you changed (...) to "..." in the process.
>
> print OUTPUT $arg->Item($i), "\n";
Xho, thank you for seeing what my eyes had failed to see a hundred
times. You've led me to an even more surprising conclusion, however,
which is that Perlscript and Perl don't seem to interpolate strings the
same way. Another version of the test program shows the problem:
<Job ID="tryit">
<script language=PerlScript>
use strict;
use warnings;
use vars('$WScript'); # Avoid "strict" warnings
my $arg = $WScript->{Arguments};
open OUTPUT,">tryit.log";
for(my $i=0; $i<$arg->{Count}; $i++) {
print OUTPUT $arg->Item($i),"\n";
print OUTPUT "$arg->Item($i)\n";
}
</script>
</job>
F:>tryit.wsf one two three
F:>type tryit.log
one
Win32::OLE=HASH(0x17da744)->Item(0)
two
Win32::OLE=HASH(0x17da744)->Item(1)
three
Win32::OLE=HASH(0x17da744)->Item(2)
Should those two print statements not produce the same result in Perl?