in reply to Re^2: finding the path of the script running as Win service
in thread finding the path of the script running as Win service

what you might want is:
BEGIN { ( our $path = $0 ) =~ s/\\[^\\]*$//; }
Now you can use $path everywhere.
The BEGIN block is done at compiletime. The rest is done at runtime. Perl compiles your script and runs the compiled then.
Read perldoc perlmod.
Boris