I know this doesn't answer your question, but using File::Basename::fileparse is a better (and cross-platform) way to parse paths:
#! /usr/bin/perl -w
use strict;
use File::Basename;
BEGIN {
our ($prog, $path) = fileparse $0, '.pl';
open STDERR, ">>$path/$prog.err" or die "invisible error";
warn "$0 started ". localtime() . $/;
}