Perl portable path separator 

Joined:
04/07/2009
Posts:
171

November 22, 2010 19:47:18    Last update: November 22, 2010 19:47:43
Use the File::Spec module for portable file path separator (e.g., '/' for Unix/Linux, '\' for Windows):
# returns 'a/b/c' on Unix; 'a\b\c' on Windows
use File::Spec;
$x = File::Spec->catfile('a', 'b', 'c');


Or
# returns 'a/b/c' on Unix; 'a\b\c' on Windows
use File::Spec::Functions;
$x = catfile('a', 'b', 'c');
Share |
| Comment  | Tags