User Tools

Site Tools


perl_notes

This is an old revision of the document!


code snippets

get base name and directory name from a file name

use File::Basename; # for fileparse
use File::Spec; # for rel2abs

# By default, the filename is not converted to absolute path.
# It has to be done manually if necessary.
#
# Note that the directory name contains '/' at the end. 
my ($base_name, $dir) = fileparse(File::Spec->rel2abs( $fname));

Ref: http://perldoc.perl.org/File/Basename.html

dummy

perl_notes.1704319392.txt.gz · Last modified: 2024/01/03 22:03 by raju