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

I am running a Dual G4 with OS X 10.2 and I keep getting this when trying to run sample code from this site.
syntax error at phone.pl line 5, near "+==" "use" not allowed in expression at phone.pl line 19, at end of line BEGIN not safe after errors--compilation aborted at phone.pl line 20.
I am a "serious" newbie, so any help would be welcome. I know that this is something to do with "use" on line 5, but why? Here is a copy of the code to help:
#!/usr/bin/perl -w package Cellular::Automata::1D; #===================================================================== +======== # # $Id: 1D.pm,v 0.01 2001/07/05 20:37:34 mneylon Exp $ # $Revision: 0.01 $ # $Author: mneylon $ # $Date: 2001/07/05 20:37:34 $ # $Log: 1D.pm,v $ # Revision 0.01 2001/07/05 20:37:34 mneylon # Initial Release # # #===================================================================== +======== use strict; use Exporter; use Carp; use Data::Dumper; BEGIN { use Exporter (); use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS); $VERSION = sprintf( "%d.%02d", q($Revision: 0.01 $) =~ /\s(\d+ +)\.(\d+)/ ); @ISA = qw(Exporter); @EXPORT = qw(); %EXPORT_TAGS = ( ); }

Replies are listed 'Best First'.
Re: Help with MAC OS X
by theorbtwo (Prior) on Jan 13, 2003 at 06:25 UTC

    1: Please put <code> tags around the code. This will preserve line breaks and number lines, making it much easier to read.

    2: It looks like long lines have been wrapped by adding a + and going to a new line. Perl sees the newline as the end of a comment, and the +====... as a +== operator (which doesn't exist), and some other garbage, and gets very confused. If you got this code from this site, use the "d/l code" link at the bottom of the node, which will give you the code just as the author intended it. (Or at least, as he typed it, which isn't always quite the same thing..)

    BTW, I doubt this problem has anything to do with this being on a Mac OS X box.

    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).