SPUG: VERY weird syntax "error"...

Brian Ingerson briani at activestate.com
Sat Dec 30 04:16:03 CST 2000


Jason Lamport wrote:
> 
> I was wondering if someone could explain this VERY puzzling behavior.
> Consider these three programs, which *should* be symantically
> identical:

Looks like you've stumbled across a known obscure bug. My coworker, Jan
Dubois, says there are similar problems with grep and map when you put
the first argument of a parenthesized list on a separate line from the
opening paren. Evidently it's a hard bug to fix.

Your problem can be boiled down to:
-------------8<------------
use strict;

my @foo = (5, 7, 9);

print(
      $foo[0]);
-------------8<------------

but this works:
-------------8<------------
use strict;

my @foo = (5, 7, 9);

print(3,
      $foo[0]);
-------------8<------------

Brian

PS Try this on 5.6.0 for fun:

    perl -e 'x{}'

or 3 bytes shorter:

    perl -ex{}

It's the Perl Golf solution to "Make Perl Crash!" (It's fixed in 5.6.1)
:(

-- 
perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf
("Just Another %s Hacker",x);}};print JAxH+Perl'

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list