kingpin007 has asked for the wisdom of the Perl Monks concerning the following question:
!#/usr/bin/perl @number = qw(1 2 3 4 5 10 11 12 13 14); print "The values within the array are @number\n\n"; print "We will now print the square root of each number in the array a +s long as it falls between the range of 100-200 \n\n"; foreach $num (@number) { $sq = $num * $num; if ($sq >= 100 && $sq <= 200) { @values = (); push(@values, $sq); } } print "Obtaining square values using foreach loop: @values\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: new to perl, need some help
by NetWallah (Canon) on Oct 02, 2012 at 04:19 UTC | |
by kingpin007 (Initiate) on Oct 02, 2012 at 04:28 UTC | |
by bimleshsharma (Beadle) on Oct 02, 2012 at 12:05 UTC | |
|
Re: new to perl, need some help
by kcott (Archbishop) on Oct 02, 2012 at 06:48 UTC | |
|
Re: new to perl, need some help
by marquezc329 (Scribe) on Oct 02, 2012 at 06:20 UTC | |
|
Re: new to perl, need some help
by ww (Archbishop) on Oct 03, 2012 at 03:28 UTC |