If you are processing the elements in a list, use "next" to skip the rest of the loop and go to the next iteration. Just like the "continue" statement in C. You should be able to do (if you don't care about the reason):
opendir() or next;
Also, you should be clear that opendir opens a directory to read the list of files with readdir. You should check if the file is a directory before trying to open it. You can even use "next" to short-circuit the loop.
next unless -d $file;
BTW, it is an idiom in Perl to loop through a list with foreach instead of incrementing a counter ($II) like in C/Java. It is faster and makes the control clearer.