CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
breaking the path to root, subroot and subsubroot

 



biswa_pradhan
New User

Oct 25, 2015, 8:25 PM

Post #1 of 2 (840 views)
breaking the path to root, subroot and subsubroot Can't Post

Hi
I am new to perl. I am stuck with a requirement to break the path into root, subroot and so on. My path is D:\All\Mine; I want to fetch 'D','All' and 'Mine'. I do not want to use substr. Please suggest me a way.


BillKSmith
Veteran

Oct 26, 2015, 5:30 AM

Post #2 of 2 (836 views)
Re: [biswa_pradhan] breaking the path to root, subroot and subsubroot [In reply to] Can't Post

The safest way to parse a path is to use a module such as File::Basename. An easier solution which almost always works is to split the string into fields using the function 'split' (refer: perldoc -f split).

We are not here do your homework for you. If you are still not able to solve the problem, show us what you have tried and how it failed.
Good Luck,
Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives