in reply to loop array excluding some elements
you can use map function in PERL to do a one line parsing of array. Below is an example which is similar to you code and you can extend to what ever you want to add in the if loop.
@tt = (1,2,3,5,0,7,8,9,10); map{if($_!=0){print "I did something when it is not zero\n";}}@tt;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: loop array excluding some elements
by AnomalousMonk (Archbishop) on Mar 09, 2018 at 15:45 UTC | |
by karthiknix (Sexton) on Mar 12, 2018 at 17:16 UTC | |
by AnomalousMonk (Archbishop) on Apr 19, 2018 at 20:58 UTC |