Someone called Peter McEvoy said on Fri, May 12, 2000 at 12:07:29PM +0100:
> Anyone know of a platform independant way of figuring out what the path
> separator is in Perl (/ vs \)? (I'm developing on NT for use on a UNIX
> machine, and I'm doing a lot of stuuf with path manipulation/searching).
>The Special variable $^O is always equal to the OS type the script is running
on. So something like:
if($^O eq "WIN32")
{
$seperator = "\";
}
else
{
$seperator = "/";
}
It mightn't be "WIN32", I don't have a windows box to find that out, more's
the pity. Try printing it out first to find out, then use the if.
- DoC
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!