use strict; use warnings; use Getopt::Long; my $user; my $password; GetOptions( 'fetch' => \&fetch, 'user=s' => \$user, 'password=s' => \$password, ); sub fetch { my @vars = @_; print "We're now in fetch\n"; print "The vars are @vars\n"; print "The user is $user\n"; print "The password is $password\n"; routine1($user); } sub routine1 { my @var = @_; print "We're now in routine1\n"; print "The vars for routine1 @var\n"; print "The user for routine1 is $user\n"; } #### ./mygetopt5.pl -f -user user1 -pass password We're now in fetch The vars are fetch 1 Use of uninitialized value in concatenation (.) or string at ./mygetopt5.pl line 22. The user is Use of uninitialized value in concatenation (.) or string at ./mygetopt5.pl line 23. The password is We're now in routine1 Use of uninitialized value in join or string at ./mygetopt5.pl line 32. The vars for routine1 Use of uninitialized value in concatenation (.) or string at ./mygetopt5.pl line 33. The user for routine1 is