Arranging files

Hi all,
This is program to identify and arrange programs(scripts) based on their she-bang values to a folder with the same name.
The parts of mkdir and copy and creating problems.I also doubt the use of hash...maybe some problems in it.
Please help out debugging this.

Code pasted at:
Paste Code

***Code also added by reborg:

1:  #!/usr/bin/perl -w
2:  use File::Find;
3:  use File::Copy;
4:  %ext=("perl",pl,"bash",sh,"sed","ed","awk","aw");
5:  find(\&call,".");
6:  sub call{
7:   $var=$File::Find::name ;
8:   open(fh,$var) or die "Couldn't open file"; 
9:   $line=<fh>;
10:  if($line=~/^\#!.*?(\w+)\s+/){$dir=$1;}
11:   $p= $ext{$dir};
12:  if($var=~/(\w+\.)\w+/)
13:  {$new=$1.$p;}
14:  else
15:  {$new=$var.".".$p;}
16:  mkdir $ext unless( -e $ext);
17:  $newfile=$dir."/".$new;
18:  rename($var,$new);
19:  copy("$new","$newfile") or die "$!";
20:  close(fh);
21: }

These are the errors

There are some parts that are incompletely done due the errors that are being faced now.
Unquoted string "pl" may clash with future reserved word at ./arrange line 4.
Unquoted string "sh" may clash with future reserved word at ./arrange line 4.
Unquoted string "fh" may clash with future reserved word at ./arrange line 8.
Unquoted string "fh" may clash with future reserved word at ./arrange line 19.
Use of uninitialized value in pattern match (m//) at ./arrange line 10.
Use of uninitialized value in hash element at ./arrange line 11.
Use of uninitialized value in concatenation (.) or string at ./arrange line 13.
Use of uninitialized value in -e at ./arrange line 16.
Use of uninitialized value in mkdir at ./arrange line 16.
Use of uninitialized value in concatenation (.) or string at ./arrange line 17.
Is a directory at ./arrange line 18.

Forgive me if these are due to silly mistakes,as I am just starting with perl.

First thing first, go for the very first error, look at line 4, and see if that dosn't resolve it, if you look closely, you'll notice it is every time you refference that line it spews an error.

You might want to add a few quotes around 'pl' and 'sh'

Well i converted it to qw and made lots of modifications and ended up with 2 versions of working code(late at night).One using find and copy modules,other using directory handler.I

And

If there are any suggestions or bugs,please do tell,it would really help as I am learning Perl.