bobosm has asked for the wisdom of the Perl Monks concerning the following question:
I need help, i am new in Perl if you can help me i have a question:
I want to know how to Random generate 5 number in (num1) outside of subroutine (some) Then 5 times calls the subroutine and then displayed the results.
sub some() { print "Enter a number: \n"; chomp (my $num1 = <STDIN>); my $num2 = 2; my $result; $result = $num1+$num2; print "result is: $result"; #return result; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: calling subroutines
by roboticus (Chancellor) on Oct 12, 2013 at 15:31 UTC | |
|
Re: calling subroutines
by toolic (Bishop) on Oct 12, 2013 at 15:29 UTC | |
by bobosm (Initiate) on Oct 12, 2013 at 16:06 UTC | |
by davido (Cardinal) on Oct 12, 2013 at 16:13 UTC | |
by bobosm (Initiate) on Oct 12, 2013 at 16:25 UTC | |
by davido (Cardinal) on Oct 12, 2013 at 17:44 UTC | |
by bobosm (Initiate) on Oct 12, 2013 at 16:16 UTC | |
by davido (Cardinal) on Oct 12, 2013 at 16:27 UTC | |
by bobosm (Initiate) on Oct 12, 2013 at 16:34 UTC | |
by builat (Monk) on Oct 13, 2013 at 05:46 UTC | |
|
Re: calling subroutines
by Marshall (Canon) on Oct 12, 2013 at 15:36 UTC | |
|
Re: calling subroutines
by Lennotoecom (Pilgrim) on Oct 12, 2013 at 17:32 UTC |