Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: changing the position of an element in an array

by nobull (Friar)
on Nov 17, 2005 at 17:48 UTC ( [id://509497]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @array = ( 'foo', 'bar', 'baz' );
    my ($pos) = grep { $array[$_] eq 'bar' } 0..$#array;
    ...
    print "@array\n"; # Prints 'foo baz bar'
    $$ref_to_element = 'zap';
    print "@array\n"; # Still prints 'foo baz bar'
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found