*BSD News Article 56502


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!miwok!news.zeitgeist.net!lind.mojones.com!seibel
From: Peter Seibel <seibel@mojones.com>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Perl
Date: 11 Dec 1995 19:41:23 GMT
Organization: Mother Jones Interactive
Lines: 60
Distribution: world
Message-ID: <4ai1h3$s98@kadath.zeitgeist.net>
References: <DJEHtG.9o@ritz.mordor.com>
NNTP-Posting-Host: lind.mojones.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: Nuntius 2.0.4_68K
X-XXMessage-ID: <ACF1CC7291017687@lind.mojones.com>
X-XXDate: Mon, 11 Dec 1995 19:54:26 GMT

In article <4aghr0$3bi@agate.berkeley.edu> Jordan K. Hubbard,
jkh@violet.berkeley.edu writes:
>It wouldn't, actually.  First off, many scripts continue to work only with
>PERL 4.  Going unilaterally to PERL 5 would break a number of things.
>Second, I think I'd like to wait until *at least* 5.002 before staking
>everyone's fates on it, doncha think? :-)


From the Perl FAQ (Q 1.5):

                     Will perl5 break my perl4 scripts?

In general, no. However, certain bad old practices have become highly
frowned upon. The following are the most important of the known
incompatibilities between perl4 and perl5. See perltrap(1) for more details.

   * @ ALWAYS interpolates in double quoted strings. Non-array @'s must be
     escaped:
          Mail("foo@bar.com")
     needs to be
          Mail("foo\@bar.com");
     The compiler catches this.
   * open FILE || die needs to be open(FILE) || die. The compiler forgives
     you for this, but won't stop complaining until you fix it.
   * Barewords are no longer (necessarily) strings: they will actually call
     the function (if it existed when that code was compiled) instead of
     returning a string of that value. Check your signal handlers. The use
     strict subs pragma (see strict(3pm) ) will help you with this.
   * shift @x + 20 needs to be shift(@x) + 20 because of precedence, and
     likewise $y = scalar keys %foo + 30 needs to be instead $y = scalar
     keys(%foo) + 30.
   * The internal symbol table is called %{PACKAGE::} for any given package.
     It used to be %{_PACKAGE}.
   * You may no longer (attempt to) write to read-only variables, like $1,
     or assign to a substr() past the end of a string.
   * Various deprecated practices elicit warning messages.
   * The package delimiter has been changed from ' to ::. Use of ' is
     deprecated, but still works. Use of :: may break scripts if you aren't
     careful (especially if you are working with colon delimited data files,
     like /etc/passwd).

###


Plus Perl 5.001m is quite stable (and has a bunch of super-cool stuff that 4
doesn't, and 4 is, I think,  now officially obsolete. (Not that you can't
still get help about it in comp.lang.perl.misc, but the number of people who
can keep track of what you can do in Perl5 vs. what you could do in Perl4 is
dwindling.) Maybe, providing both would be a good idea. (On many systems there
are two binaries, perl4.036 and perl5.001 and perl is just a symbolic link to
one or the other.) I'd certainly say there's no need to wait for 5.002, though
it's going to be out soon anyway, I understand.

-Peter


-- 

Peter Seibel                             seibel@mojones.com
Writer/Perl Hacker                             510-482-9105