NastyPenguin has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use warnings; print "Enter first Number: "; my $ipa = <STDIN>; print "Enter last Number: "; my $ipb = <STDIN>; my $ipc = $ipa +1; while ($ipc <= $ipb) { $ipc; print $ipc; } # my @range = ($ipa, $ipb); if ($ipc < $ipb){ @range = ($ipa, $ipb); unshift(@range, $ipc); } else { print $ipc; } sub ascend { $ipa = $ipb; } my @rl = sort ascend @range; print join(",",@rl);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding Numbers
by GrandFather (Saint) on Nov 21, 2010 at 04:18 UTC | |
|
Re: Adding Numbers
by kcott (Archbishop) on Nov 21, 2010 at 05:13 UTC | |
by NastyPenguin (Initiate) on Nov 21, 2010 at 05:47 UTC | |
by kcott (Archbishop) on Nov 21, 2010 at 06:19 UTC | |
|
Re: Adding Numbers
by TomDLux (Vicar) on Nov 21, 2010 at 05:59 UTC | |
by NastyPenguin (Initiate) on Nov 21, 2010 at 06:17 UTC | |
by GrandFather (Saint) on Nov 21, 2010 at 06:26 UTC | |
by TomDLux (Vicar) on Nov 22, 2010 at 01:22 UTC | |
|
Re: Adding Numbers
by PeterPeiGuo (Hermit) on Nov 21, 2010 at 05:58 UTC | |
|
Re: Adding Numbers
by Anonymous Monk on Nov 21, 2010 at 10:42 UTC | |
|
Re: Adding Numbers
by Anonymous Monk on Nov 21, 2010 at 05:56 UTC |