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

Re: Splicing Arrays on pre-defined indices

by injunjoel (Priest)
on Jun 27, 2008 at 18:33 UTC ( [id://694420]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $line = "1!2!3!4!5!6!7!8!9";
    my @arr = split /!/, $line;
    ...
    print "\n";
    print join(" : ", @arr[@indices]);#predefined
    
  2. or download this
    1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9
    3 : 6 : 7 : 8 : 9
    3 : 6 : 7 : 8 : 9
    
  3. or download this
    my $line = "1!2!3!4!5!6!7!8!9";
    my @arr = split /!/, $line;
    ...
    #set the elements to nothing and then filter them out.
    @arr[@exclude] = ();
    @arr = grep $_, @arr;
    

Log In?
Username:
Password:

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

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

    No recent polls found