Hi,

On 20 September 2011 16:50, Uri Guttman <u...@stemsystems.com> wrote:

> >>>>> "DJ" == David Jacopille <p...@shortloop.com> writes:
>
>  DJ> I get a warning "$# is no longer supported".  The program does
>  DJ> continue.
>
>  DJ> Apparently $# and $* were deprecated in regular expression context
>  DJ> and that error message exactly is documented in CPAN.
>
> these work fine:
>
> perl -lwe '$x = [1,2]; print $#$x'
> 1
> perl -lwe '$x = [1,2]; print $#{$x}'
> 1
>

I usually find I want the size (instead of the index):

perl -lwe '$x = [1,2]; print scalar(@{$x});'
2

or last element in the array:

perl -lwe '$x = ["a","b"]; print $x->[-1];'
b

Might not be relevant here but thought I'd mention them just incase.

Leo

Reply via email to