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

I am currently using ActivePerl to write up my perl program. However, when I use the same set of perl codes to run on the UNIX perl system, there're lots of syntax errors? Can anyone tell me difference in the syntax of perl codes between ActivePerl and perl system on UNIX?

Replies are listed 'Best First'.
Re: ActivePerl vs Perl on UNIX
by dempa (Friar) on Jul 13, 2000 at 15:56 UTC
    "lots of syntax errors?", you say. Makes me wonder. What do you mean by "lots".. Massive or just a few but still suspiciously many? If you use the Unix command cat to list your code, does it have a lot of ^M at the end? In that case, you have to convert it from "DOS" to Unix first. (If you transfered the files from Windows to Unix, that is. If you retyped your code in Unix, you can probably disregard this whole comment. :] )

    Just a guess, and I'm in a hurry, so I could be totally wrong. It wouldn't be the first time.. :)

Re: ActivePerl vs Perl on UNIX
by mrmick (Curate) on Jul 13, 2000 at 17:23 UTC
    Unless you are using:
    • WIN32-specific modules,
    • modules that are not installed on your UNIX box, or
    • WIN32 system calls
    there should not be any syntax errors if it worked on Windows.

    I often use ActivePerl on WIN32 and then transfer the files to UNIX. Mostly because I'm lazy and want the same scripts on both platforms.

    Also, be sure to use Strict; and the -w flag. This way you can minimize other kinds of errors, or at least track them down a lot more easily.( I guess we can't say enough of this )

    Mick
      The differences between ActivePerl on Windows & Unix are unclear from the docs. How does an ActivePerl install under Unix (specifically Redhat6.x) and a plain perl source code recompile compare? Have they disabled the unix specific functionality as the FAQ described (IPC etc.) or does that section only apply to ActivePerl Win32?
        Although I haven't used ActivePerl for UNIX / LINUX, I can say with some degree of comfort that I don't think ActiveState would take away the power that is Perl.

        One of the great things about Perl is that, while you can write portable code, you can also take advantage of the platform it runs on.

        They would be doing Perl and themselves injustice if they took away useful features.

        Besides, it's Perl. Nothing will change that for now.

        Mick
Re: ActivePerl vs Perl on UNIX
by davorg (Chancellor) on Jul 13, 2000 at 16:25 UTC

    Maybe you could give an example of the kinds of errors that you are seeing so that we could give a little more help. There are very few differences between Perl running on differnet platforms... of course, using the Win32 modules will only work on Windows.

    --
    <http://www.dave.org.uk>

    European Perl Conference - Sept 22/24 2000, ICA, London
    <http://www.yapc.org/Europe/>
      You can check which version of perl is installed with
      perl -v
      The ISP I use has both versions installed. Perl4 is in '/usr/bin', and Perl5 is in '/usr/local/bin'. Both are simply named 'perl', so the -v option is the only way to distinguish them.

      You might try the following command to hunt for any versions of perl that are installed (results not garanteed)
      find /usr -name perl -print
      Hope this helps.

      --Chris

      e-mail jcwren
      yes yes the main problem I have dealt with is "chomp". This command works on ActivePerl but it doesn't work when I ran it under UNIX. Here's my command line: chomp $current; The following is the error msg I have epxerienced when I run it under Unix: syntax error in file readmail.pl at line 185, next 2 tokens "chomp $current" /.*?boundary=/: nested *?+ in regexp at readmail.pl line 239. can anyone interpret it for me please? many thanks in advance.

        Your Unix server has a very old version of Perl. Probably version 4.036 or something around that. Try to get it upgraded to something that isn't six years out of date!

        --
        <http://www.dave.org.uk>

        European Perl Conference - Sept 22/24 2000, ICA, London
        <http://www.yapc.org/Europe/>
Re: ActivePerl vs Perl on UNIX
by DrEAX (Initiate) on Jul 13, 2000 at 21:05 UTC
    Have you added the shebang? (the #!/usr/bin/perl on first row)

    DrEAX
    Dr@Nyvell.net