JupiterHost.Net wrote:
Hello again,

I need to make sure a given path has an ending path separator:

my $file = 'joemama';
my $path = '/foo/bar/wiz';
$path .= '/' if $path !~ m/\/$/;

So I can then do
 "$path$file"
and ensure its /foo/bar/wiz/joemama and not /foo/bar/wizjoemama

The question is, DIfferent systems use different seperators, / \ :

So I'd like to use a portable way to specify the seperator instead of harcodeing it into the code.

I'm wondering if $Config{path_sep} is what I'm looking for, it seems to make sense but on my Mac OS X, and some FreeBSD and Linux servers in the shell its all / but that var is : so I'm a bit confused :)

 my $sep = $Config{path_sep} || '/';
 my $file = 'joemama';
 my $path = '/foo/bar/wiz';
 $path .= $sep if $path ....

Any ides how to safely find if the current OS uses / \ : or whatever in path names?


Is $Config{prefix} (or one of its cousins) what I'm looking for instead?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to