This is just an error in your logic, basically. What you want is
probably:
if ($File::Find::name =~ m!^/some_dir/sub_dir!) {
print "skipping $dir\n';
$File::Find::prune = 1;
return;
}
In other words, test $File::Find::name, not $File::Find::dir.
When process gets called, dir holds the name of the *containing*
directory. So when process gets called for the entry
"/some_dir/sub_dir", dir is "/some_dir". You're expecting it
to be "/some_dir/sub_dir", but it's not that until you've actually
descended into "sub_dir". So you're skipping all the entries below
"sub_dir" but not descending into "sub_dir" itself.
Make sense?
By the way, "$dir/$_" is just $File::Find::name. I think.