On 2 Aug 2006 at 3:24, BenBart wrote:

> Hi all,
> 
> Can anyone please tell me how to get the BASENAME and BASEDIR of a file 
> ... i.e. for example, if I have C:\Windows\Temp\Dir1\MyFile.TXT, I want 
> to be able to get the BASENAME which is MyFile and the BASEDIR which is 
> C:\Windows\Temp\Dir1 and assign them to variables ...

perldoc -m File::Basename

use File::Basename;

$basename = basename($fullname);
$dirname = dirname($fullname);

print "File=$basename, Directory path=$dirname\n";

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to