I'm converting perl script to python.
I haven't used perl language before so many things in perl confused me.
For example, below, opt was declared as a scalar first but declared again as a hash. %opt = (); 
Is it possible to declare a scalar and a hash with the same name in perl? 
As I know, foreach $opt (@opts) means that scalar opt gets values of array opts one by one. 
opt is an array at this time??? 
In addition, what does $opt{$opt} mean?
opt outside $opt{$opt} is a hash and opt inside $opt{$opt} is a scalar?
I'm so confused, please help me ...
sub ParseOptions
{
    local (@optval) = @_;
    local ($opt, @opts, %valFollows, @newargs);
    while (@optval) {
        $opt = shift(@optval);
        push(@opts,$opt);
        $valFollows{$opt} = shift(@optval);
    }
    @optArgs = ();
    %opt = ();
    arg: while (defined($arg = shift(@ARGV))) {
        foreach $opt (@opts) {
            if ($arg eq $opt) {
                push(@optArgs, $arg);
                if ($valFollows{$opt}) {
                    if (@ARGV == 0) {
                        &Usage();
                    }
                    $opt{$opt} = shift(@ARGV);
                    push(@optArgs, $opt{$opt});
                } else {
                    $opt{$opt} = 1;
                }
                next arg;
            }
        }
        push(@newargs,$arg);
    }
    @ARGV = @newargs;
}
 
     
    