Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: subtract one array from another

by antifun (Sexton)
on Oct 17, 2002 at 13:49 UTC ( #206022=note: print w/ replies, xml ) Need Help??


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


Comment on Re: Re: subtract one array from another
Select or Download Code
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....

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://206022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2014-09-19 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (142 votes), past polls