Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I usually travel a lot, most of the time I would only cary my USB external storage. But I was wondering if there is any beter way, as currently I would save PERL folder with the script. So when I open it in another computer I would click the PERL script and then the computer would ask 'open with..' I would browse to the PERL folder and select the PERL interpreter. If there's way so that I just click PERL script and the computer know where to find the PERL interpreter? Thanks

Replies are listed 'Best First'.
Re: Perl Interpreter
by Corion (Patriarch) on Aug 09, 2004 at 07:11 UTC

    Depending on the flavour of Windows you are using, there are some more possibilities. The easiest way to start your Perl script is through a .cmd file which invokes Perl with the correct parameters, but for that, you need to be on Windows NT (no USB!), Windows 2000 or Windows XP:

    @echo off cd /d %~dp0 \perl\perl.exe myscript.pl

    This assumes that your USB drive looks like the following:

    U:\ U:\perl U:\perl\perl.exe U:\myscript.cmd U:\myscript.pl

    The two files myscript.cmd and myscript.pl can be located anywhere on your USB stick, but they must be in the same directory!

    If you want to script this for Windows 9x as well, you will need to register the .pl extension with Windows through a autorun.inf file in the root directory of your USB stick.

Re: Perl Interpreter
by CountZero (Bishop) on Aug 08, 2004 at 18:32 UTC
    And on what OS would you be using your USB device?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      If the computer is asking "Open with..", I'd put my money on some flavour of Windows.

      Makeshifts last the longest.

        That would be my guess as well, but there are so many forms and versions of Windows that just guessing "Windows" is still too vague.

        Also if it was on some form of Unix/Linux, the "shebang" line would work and the problem would just not exist.

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law