my $SAVE_PLACE; GetOptions( 's|save_to:s' => \$SAVE_PLACE, ); # here the value of $SAVE_PLACE will be: # undef if no -s --save_to # 0 if -s --save_to but no optional argument # <str> if -s=<str> while ( defined $SAVE_PLACE and not $SAVE_PLACE ) { $SAVE_PLACE = prompt("Save to where: "); } sub prompt { print @_; chomp(my $ans = <>); $ans }
In reply to Re: Using Getopt::Long and prompting for arguments
by tachyon-II
in thread Using Getopt::Long and prompting for arguments
by azredwing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |