Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-12-22 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls