#!/usr/bin/perl -w

use Getopt::Long;

#In this function the flag is specified by "foo".  A flag that takes a value
#  is specified as "foo=s".  The s means that a scalar variable is being read in.
#  When a value is read in, it is assigned to $foo.  (See $name and $age).
GetOptions("verbose" => \$verbose, "name=s" => \$name, "age=s" => \$age);

if($verbose)
{
  print "Verbose mode!\n";
}

if(!$name || !$age)
{
  print "USAGE: example1 [-verbose] -name NAME -age AGE\n";
  exit;
       
}

if($verbose)
{
  print "Building string to print.\n";
}

$string = "$name is $age years old.\n";

print $string;
