http://www.perlmonks.org?node_id=206022


in reply to Re: subtract one array from another
in thread subtract one array from another

The $#array syntax is vaguely deprecated, IIRC...
for my $search (0..scalar @array1)
But since the .. operator takes scalar context, you can just say
for my $search (0..@array1)

(Update: the "vague deprecation" was from one of the Apocalypses. So it's safe for the indefinite future, I suppose. cf. Apocalypse 2)


---
"I hate it when I think myself into a corner."
Matt Mitchell

Replies are listed 'Best First'.
Re: Re: Re: subtract one array from another
by zigdon (Deacon) on Oct 17, 2002 at 13:55 UTC
    Don't you need a -1 there someplace?
    perl -le ' @a = qw/a b c d/; print scalar @a; print $#a; __DATA__ output: 4 3 '

    -- Dan

Re: Re: Re: subtract one array from another
by demerphq (Chancellor) on Oct 17, 2002 at 16:07 UTC
    Yes I seem to remember hearing that... But then Juerd corrected me. I do not believe that it will in fact be going away.

    And of course as the someone else mentioned that should be @array1-1

    :-)

    --- demerphq
    my friends call me, usually because I'm late....