Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: insertion of array element

by damian1301 (Curate)
on Jun 03, 2001 at 07:56 UTC ( #85267=note: print w/ replies, xml ) Need Help??


in reply to Re: insertion of array element
in thread insertion of array element

Good post. If you wanted to get it in the middle of an array more that 4 indexes then you could make a slight adjustment to it to be more versatile.

my @a = (a..g); print "@a\n"; splice @a, ($#a+1)/2, 0, (1..5); print "@a\n";


Tiptoeing up to a Perl hacker.
Dave AKA damian


Comment on Re: Re: insertion of array element
Download Code
Re: Re: Re: insertion of array element
by MeowChow (Vicar) on Jun 03, 2001 at 09:29 UTC
    I keep seeing $#list + 1 in code posted to perlmonks. Remember that this is the same thing as @list in a scalar context.

    Henceforth, I shall wage a jihad against the former expression :)

       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2014-09-01 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (299 votes), past polls