Welcome to the Monastery, mbravismore!
Normally, I'd skip such a question due to no effort shown whatsoever (please do so in the future), but I thought I'd at least show a basic skeleton that you can at least get started with. See the documentation of Getopt::Long to get an understanding of what is happening. You'll want/need to add in some parameter checking to ensure all required arguments are passed in.
use strict; use warnings; use Getopt::Long; my %args; GetOptions ( 'i|txtpatid=s' => \$args{txtpatid}, 'p|txtpatpw=s' => \$args{txtpatpw}, 's|txtpatserver=s' => \$args{txtpatserver}, ); for (keys %args){ print "$_: $args{$_}\n"; }
Run it:
perl script.pl -i stevieb -p secret -s user
Output:
txtpatid: stevieb txtpatpw: secret txtpatserver: user
In reply to Re: perl script that accepts parameters via STDIN
by stevieb
in thread perl script that accepts parameters via STDIN
by mbravismore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |