LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Path separator in Perl

[ILUG] Path separator in Perl

Dave O Connor doc at redbrick.dcu.ie
Fri May 12 12:19:53 IST 2000


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




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell