The problem is relative versus absolute paths. You create directory VEHICLES, move to it, and in the first loop you create directory CARS and then move to it. But the chdir $dir statement tries to move to VEHICLES->CARS->VEHICLES which of course doesn't work. You need to change the value in your chdir statement to an absolute path. Perhaps something like:
my @files=qw/CARS BIKES/;
chomp(my $home = `pwd`);
my $dir = 'VEHICLES';
foreach my $file(@files)
See here if you aren't familiar with chomp.
But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)