in reply to uninitialized variable

$location = shift(@ARGV); will set $location to undef if no arguments have been passed to the script (@ARGV refers only to the command line, as bbfu points out). That's why you're getting the warning.

For cases like these, you can either do:

my $location = shift @ARGV or die "usage: $0 [filename]\n";

or, if you want a default,

my $location = shift || 'default value';

Minor amplification shift called without an explicit argument will return the next element of @ARGV if it is called outside a subroutine, and returns the next element of @_ if called within a subroutine.

HTH

Philosophy can be made out of anything. Or less -- Jerry A. Fodor