Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call subroutine?

Status
Not open for further replies.

bobodm

Technical User
Oct 12, 2013
1
AT
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;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top