newly has asked for the wisdom of the Perl Monks concerning the following question:
I need help with problem... i need to create a program that have two subroutines add() and multiply() that will add or multiply its arguments and print the result in screen. this is my current code: if ($ARGV[0] =~ /add/) { $rtn = add($ARGV[1]); print "The sum is: $rtn"; } elsif ($ARGV[0] =~ /multiply/) { $rtn = multiply($ARGV[1]); print "The product is: $rtn"; } sub add { } sub multiply { } can anybody fill me in this code..im kinda confused.. thanks for your help guys..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: subroutines problem
by mrborisguy (Hermit) on Jul 20, 2005 at 01:01 UTC | |
by newly (Initiate) on Jul 20, 2005 at 01:22 UTC | |
|
Re: subroutines problem
by dorko (Prior) on Jul 20, 2005 at 01:24 UTC | |
by newly (Initiate) on Jul 20, 2005 at 01:30 UTC | |
|
Re: subroutines problem
by NetWallah (Canon) on Jul 20, 2005 at 06:29 UTC | |
by newly (Initiate) on Jul 20, 2005 at 23:14 UTC | |
by NetWallah (Canon) on Jul 21, 2005 at 04:23 UTC |