[comp.lang.perl] estoteric weird assoc-array slice bug

merlyn@iwarp.intel.com (Randal Schwartz) (02/06/90)

Okay, I've done it this time.  I was working on my new signature for
this group, and came across a bug (gasp! :-).

% perl -e '@a=(); %a=(1,88,2,99); print "@a{1,2}\n";'
88 99
% perl -e '%a=(1,88,2,99); print "@a{1,2}\n";'
@a{1,2}

This is with Perl pl 6 (still waiting for patch 9, Larry :-).

I *know* about the safety feature that says that an "@foo" doesn't get
interpreted unless the corresponding @foo array exists, but why should
the assoc-array slice require a corresponding array to exist?  That's
weird.  Just 'cause it starts @foo, doesn't mean I'm talking about a
foo array!

Sigh. :-)

%_=split(/(\D+)/,"7Perl6another8hacker,5Just");print"@_{5..8}";
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/07/90)

In article <1990Feb5.180859.6270@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes:
: Okay, I've done it this time.  I was working on my new signature for
: this group, and came across a bug (gasp! :-).
: 
: % perl -e '@a=(); %a=(1,88,2,99); print "@a{1,2}\n";'
: 88 99
: % perl -e '%a=(1,88,2,99); print "@a{1,2}\n";'
: @a{1,2}

>> patch 9.

: This is with Perl pl 6 (still waiting for patch 9, Larry :-).

I might be able to get patch 9 out if you didn't keep adding to it, Randal :-).

Larry