Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Replacing values in an array

by muba (Priest)
on Jan 27, 2013 at 05:37 UTC ( #1015562=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @numbers = (0, 0.5, 1, 1.5, 2, 2.5);
    
    ...
    
    my @basket_1 = grep defined, @basket;
    print "The number of *defined* elements in \@basket is ", scalar(@bask
    +et_1), "\n";
    
  2. or download this
    my @numbers = (0, 0.5, 1, 1.5, 2, 2.5);
    
    ...
        push @basket_1, $_ if defined;
    }
    print "The number of *defined* elements in \@basket is ", scalar(@bask
    +et_1), "\n";
    
  3. or download this
    my @numbers = 1..10;
    my @times_ten = map { $_ * 10 } @numbers;
    print join(", ", @times_ten), "\n";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-09-16 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls