Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Splicing Arrays on pre-defined indices

by injunjoel (Priest)
on Jun 27, 2008 at 18:33 UTC ( #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
Node Status?
node history
Node Type: note [id://694420]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2020-10-25 05:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?