Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: substituting values in an array

by talexb (Canon)
on Jun 18, 2013 at 16:38 UTC ( #1039592=note: print w/ replies, xml ) Need Help??

in reply to substituting values in an array

Here's some code that worked for me:

#!/usr/bin/perl use strict; use warnings; { my @arr = qw/200 201 205 194 140 250 280/; print "Original array is " . join(', ',@arr) . "\n"; @arr = map { $_ > 200 ? 200 : $_ } @arr; print "Limited array is " . join(', ',@arr) . "\n"; }

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Comment on Re: substituting values in an array
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2015-11-25 20:59 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (690 votes), past polls