Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Array manipulation how to

by moritz (Cardinal)
on Feb 07, 2012 at 08:53 UTC ( [id://952228]=note: print w/replies, xml ) Need Help??


in reply to Array manipulation how to

swap two elements of an array
@array[$index1, $index2] = @array[$index2, $index1];
step $index in direction $dir (+1 or -1) in array in a 'circular' way:
$index = ($index + $dir) % @array; print $array[$index];

Replies are listed 'Best First'.
Re^2: Array manipulation how to
by jwkrahn (Abbot) on Feb 07, 2012 at 11:07 UTC
Re^2: Array manipulation how to
by chessgui (Scribe) on Feb 07, 2012 at 09:25 UTC
    What kind of sytax is this: @array[$index1,$index2]? What does this exactly mean?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-19 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found