Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

File::Basename

by Rhose (Priest)
on Sep 01, 2001 at 01:21 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://109558]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-24 00:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found