Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

File::Basename

by Rhose (Priest)
on Sep 01, 2001 at 01:21 UTC ( #109558=note: print w/replies, xml ) Need Help??


in reply to Re: filetype extension query
in thread filetype extension query

I would also use File::Basename.

Sample use:

use strict; use File::Basename; my $mFileName; my $mFilePath; my $mFileExt; foreach ( '/home/rhose/work/perl/test', '/home/rhose/work/perl/test.pl', 'c:\work\perl\test', 'c:\work\perl\test.pl' ) { ($mFileName, $mFilePath, $mFileExt)=fileparse($_,'\.[^.]*'); print "Full:\t",$_,"\n"; print "Path:\t",$mFilePath,"\n"; print "Name:\t",$mFileName,"\n"; print "Ext:\t",$mFileExt,"\n"; print "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://109558]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2019-08-25 00:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?