pc88mxer has already answered your specific questions. I thought I'd give you some tips to make using regexps a little easier on the eyes.
- You can create regexp objects with the qr operator. This allows you to build more complex regexps out of simple pieces, and to give the individual pieces names.
- Inside character classes, only ^ and - are special. There's no need to escape the rest, which removes a lot of your backslashes.
Example:
my $drivespec = qr{[a-zA-Z]:};
my $dir = qr{[^<>":|?*]*};
my $path = qr{^ $drivespec? $dir $}x;
unless( $input->{$key} =~ $path ) {
...
}
This barely scratches the surface, of course. More reading at perlrequick, perlretut, perlre, and here in the Tutorials section.