kvwood (3) [Avatar] Offline
#1
Hello all,

I initially tried running the scripts as printed in Minimal Perl under ActivePerl on Windows, with no success. After much trial and error, I discovered that the quoting needs to be changed from ' ... ' to " ... " after the -e command line switch.

So, this (on Linux):
$ perl -wnl -e '$. >= 458 and $. <= 478 and print "$.: $_";' myfile

becomes this (on Windows):
c:> perl -wnl -e "$. >= 458 and $. <= 478 and print "$.: $_";" myfile

Note how you need to use the " ... " escape sequence with print " ... ", since it is already enclosed in double quotes.

I haven't tried anything on Windows past chapter 4, so I don't know if there are any further changes needed.

It would be great if the book could be updated with an appendix informing Windows users of these conversion issues. I know the book draws parallels with the Unix shell utilities, but these Perl scripts are just as useful on Windows, and perhaps even more useful, since the typical Unix tools are missing.

Message was edited by:
kvwood
tmaher (37) [Avatar] Offline
#2
Re: Modifying scripts for Windows
> Hello all,
>
> I initially tried running the scripts as printed in
> Minimal Perl under ActivePerl on Windows, with no
> success. After much trial and error, I discovered
> that the quoting needs to be changed from ' ... ' to
> " ... " after the -e command line switch.

Glad you figured this out! But you're modifying commands here;
scripts won't need these kinds of modifications.

> It would be great if the book could be updated with
> an appendix informing Windows users of these
> conversion issues. I know the book draws parallels
> with the Unix shell utilities, but these Perl scripts
> are just as useful on Windows, and perhaps even more
> useful, since the typical Unix tools are missing.
>
> Message was edited by:
> kvwood

I'm inclined to agree with you, and I'll look into the possibility of providing some basic
guidelines at MinimalPerl.com to help readers run the book's programs on
Windows.

-Tim