Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2014-12-22 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (113 votes), past polls