Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
No such thing as a small change
 
PerlMonks  

Re: How do I extract a file name from a path string

by Anonymous Monk
on Oct 08, 2004 at 10:58 UTC ( [id://397661]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How do I extract a file name from a path string

$filepath = '/u/test/global/filename.txt'; my ( @data ) = split /\//, $filepath; my ( $filename ) = $data[$#data]; print "$filename" ; ## will print filename.txt

Replies are listed 'Best First'.
Re: Answer: How do I extract a file name from a path string
by TVSET (Chaplain) on Oct 09, 2004 at 13:04 UTC
      <br>'s removed now.
Re: Answer: How do I extract a file name from a path string
by TedPride (Priest) on Oct 09, 2004 at 15:59 UTC
    my $filepath = '/u/test/global/filename.txt'; my $fname = substr($filepath, rindex($filepath, '/') + 1);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://397661]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.