Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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 chanting in the Monastery: (7)
As of 2016-02-08 13:07 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (276 votes), past polls