fork(2) download
  1. use Getopt::Long(qw/GetOptionsFromString/);
  2. my $tag; # option variable with undef default value
  3. GetOptionsFromString('--tag', 'tag:s' => \$tag);
  4.  
  5. if (defined $tag) {
  6. if ($tag eq '') {
  7. $tag = '7.7.7.7';
  8. }
  9. print $tag;
  10. }
  11. else {
  12. print 'No option supplied';
  13. }
Success #stdin #stdout 0.03s 4928KB
stdin
Standard input is empty
stdout
7.7.7.7