Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 scrutinizing the Monastery: (5)
As of 2015-07-31 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls