Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Absolute path problem

Reply
Thread Tools

Absolute path problem

 
 
seema
Guest
Posts: n/a
 
      03-22-2005
hi all,
I am fresher learning perl programming. Is it possible
to resolve the (.,~) to give the absolute path. for
example to parse strings like "~john" or "../john/LFS"
to get the absolute path of directory specified. I have tried glob() it only
resolves string when used as command. Somebody please
help me to get the absolute path.

thanks in advance
Seema Rao
 
Reply With Quote
 
 
 
 
phaylon
Guest
Posts: n/a
 
      03-22-2005
seema wrote:

> I have tried glob() it only resolves string when used as command.


Please read the posting guidelines and give an example of what you've
tried.

phaylon@hamlett:~> perl -e "print 'Homedir: ', glob('~')"
Homedir: /home/phaylon

hth,p

--
http://www.dunkelheit.at/
sapere aude.

 
Reply With Quote
 
 
 
 
Brian McCauley
Guest
Posts: n/a
 
      03-23-2005


seema wrote:

> I am fresher learning perl programming.


So it is quite likely that most questions you have will be one that are
frequently asked.

> Is it possible
> to resolve the (.,~) to give the absolute path. for
> example to parse strings like "~john" or "../john/LFS"
> to get the absolute path of directory specified.


Those are two separate questions. ~ and .. are conceptually very
different - one is part of the shell and the other part of the filesystem.

Both questions are frequently asked and one is even Frequently Asked.

The answer to one is Cwd::abspath but that you probably really should
not do it - it is usually detremental to convert a relative path to an
absolute one. See numerous previous threads for details.

The answer to the other question is in the FAQ.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How does one get an absolute absolute file path? James Byrne Ruby 3 09-14-2010 06:02 PM
How do I convert an absolute path into a relative path Nigel Wilkinson Ruby 2 07-25-2005 07:37 PM
Absolute path in Manifest Class-Path header? bo_kid@yahoo.com Java 10 05-30-2005 01:43 PM
absolute path versus relative path in JSP Matt Java 3 07-08-2004 08:31 PM
Make a relative url path from an absolute path to another one Thomas Guettler Python 3 10-27-2003 04:41 PM



Advertisments