in reply to Playing with $[

The 'use' that perl is complaining about is '$[ = $[+1'. From perlvar,

As of release 5 of Perl, assignment to $[ is treated as a compiler directive

You can assign to it at compile time (ie $[ = 5; ), but cannot modify it at runtime (ie $[++; ).

Replies are listed 'Best First'.
Re: Re: Playing with $[
by LAI (Hermit) on Jul 06, 2002 at 19:19 UTC
    Okay, I get it now. So I could still do some playing around with
    @rray = ( 'foo', 'bar', 'spam', 'eggs' ); $[=3; $calar = $[; print $rray[$calar] while $calar++<@rray;
    but not
    @rray = ( 'foo', 'bar', 'spam', 'eggs' ); $[=$#rray $calar = $[; print $rray[$calar] while $calar++<@rray;
    Good to know. Thanks, jsprat

    LAI
    :eof