title: Global Symbol requires package name while using "my" in Sub
body: <p>I have a class where we are learning Perl so forgive me if I made a simple/obvious error as I am still learning. My question is why do I get the error</p>
  
  <blockquote>
    <p>Global Symbol "%localhash" requires explicit package name</p>
  </blockquote>
  
  <p>as well as the same error for "$param" when I do declare it with "my %localhash" the first time inside the Sub.</p>
  
  <p>My code for reference:</p>
  
  <pre><code>use strict;
  use warnings;
  use Exporter;
  use vars qw(@ISA @EXPORT);
  
  @ISA=qw(Exporter);
  @EXPORT=("insert_user", "modify_user", "remove_user", "generate_list");
  
  
  #Insert user Function
  Sub insert_user{
      my $param = shift;
      my %localhash = %$param;
      print "Please enter Username: ";
      my $user_name = &lt;&gt;;
      chomp($user_name);
      if(exists ($localhash{$user_name})){ 
          print "Error, user already exists!";
          last;
      }
      $user_name =~ s/[^a-zA-Z0-9]//g;
      $user_name = lc($user_name);
      $localhash{$user_name};
      return %localhash;
      print "Please enter a password: ";
      my $user_password = &lt;&gt;;
      %localhash{$user_name} = $user_password;
      return %localhash;
  }
  </code></pre>
  
  <p>In my class we are suppose to use "my $param" and "my %localhash" various times so I would repeat the same process in declaring "my" in every Sub but I keep getting the same error as if the "my" is not there.</p>