jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I've this minor problem with File::Spec, and it has todo with the construction of, lets say /usr/local/ABC/
This doesn't work:
use File::Spec ; use lib File::Spec->catfile( qw( use local ABC ) ) ;
Because its result is:use lib usr/loca/ABC
I need a / at the beginning. If I drop the qw I can do it also like this:
use lib File::Spec->catfile("","usr","local"ABC") ;
I can imagine this is not the best way or is it ?

Thanks in advance
Luca

Replies are listed 'Best First'.
Re: Construction of a directory (path)
by adrianh (Chancellor) on Feb 17, 2006 at 11:04 UTC
    File::Spec->catfile( File::Spec->rootdir, qw( use local ABC ) ) ;
Re: Construction of a directory (path)
by Anonymous Monk on Feb 17, 2006 at 11:04 UTC
    use lib File::Spec->rootdir() . File::Spec->catfile(qw(usr local ABC));