in reply to What's your programming style?

Which programming style do you like? Which one should I use?
Athanasius has already provided a much nicer alternative.

I'll briefly nitpick your style of using the || operator (as in index($Y,'WIN')<0||return'\\';). For flow of control, prefer the low precedence or operator. A common example of preferring or to || is:

open(my $fh, '<', $file) or die "error opening '$file': $!";
That is probably the principal use case as to why the low precedence operators were added to the language in the first place. Reserve && and || for logical expressions, not flow of control, for example:
if ($x > 5 && $y < 10) ...

This is discussed in detail in Perl Best Practices, Chapter 4, "Values and Expressions" in the "Don't mix high- and low-precedence booleans" item.

Re OS path portability, the core Perl module that deals with this is File::Spec and that is perhaps what you should be using (hard to know without understanding your bigger picture). Note that if you only need to target *nix and Windows (update: and modern Macs running BSD-derived MacOS), you can avoid File::Spec simply by using / as the path separator; this works because the Windows API treats forward slashes and back slashes equivalently in file path arguments to all Windows API functions. A minor annoyance is that Windows commands typically use forward slash for command line argument options. So, while using forward slashes in file paths is fine when calling all Perl internal functions on Windows, using them in command line arguments when running Windows commands is problematic - in the rare cases where you need to pass a file path to an external Windows command, you can translate it like so: $filepath =~ tr{/}{\\}

More useful than nitpicking low level details of programming style is to look at the bigger picture; some references on that follow: