Charley420
asked on
Perl User Input Question
Dear Experts,
Objective: to store user input $1 and $2 in two different variables
Goal: execute the script with the below command
#prodcredclnt.pl U12345 25.00
Question: How do I store U12345 into a variable $acctnum and 25.00 in a variable name $diffamnt?
My poor attempt:
@arr = <STDIN>
$acctnum = $arr[0];
$diffamnt = $arr[1];
Question: what is the easiest way to accomplish this?
Many thanks for your help,
James Chen
Objective: to store user input $1 and $2 in two different variables
Goal: execute the script with the below command
#prodcredclnt.pl U12345 25.00
Question: How do I store U12345 into a variable $acctnum and 25.00 in a variable name $diffamnt?
My poor attempt:
@arr = <STDIN>
$acctnum = $arr[0];
$diffamnt = $arr[1];
Question: what is the easiest way to accomplish this?
Many thanks for your help,
James Chen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
die "Usage $0 [acctnum] [diffamnt]\n" unless $#ARGV == 1;