Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by RazorbladeBidet (Friar)
on Mar 31, 2005 at 18:58 UTC ( #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
Node Status?
node history
Node Type: note [id://443929]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2020-12-02 22:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (47 votes). Check out past polls.

    Notices?