Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Replacing values in an array

by muba (Priest)
on Jan 27, 2013 at 05:37 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1015562]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 06:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found