Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Inserting an element into an array after a certain element

by RazorbladeBidet (Friar)
on Mar 31, 2005 at 18:58 UTC ( [id://443929]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    @array = map { $_ eq "c" && !$found++ ? ("c","f") : $_ } @array
    
  2. or download this
     sub insert_after_first {
       my $arr_ref = shift;
    ...
    
       map { $_ eq $insert_after_me && !$found++ ? ( $insert_after_me, $to
    +_insert ) : $_ } @$arr_ref;
     }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-18 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found