Recent Notes
Displaying keyword search results 1 - 2
Created by Dr. Xi on June 20, 2011 15:18:06
Last update: June 20, 2011 15:18:06
Perl does not have built-in functions to get the base name or dir name from a file path. But on the Unix platforms we can rely on the executables basename and dirname .
#!/usr/bin/perl
$f = '/A path with/space "/file...
The quotes, escapes, and chomp are necessary:
# This fails when there's a space in $f
$base =...
Created by Dr. Xi on May 31, 2007 01:58:44
Last update: May 31, 2007 01:58:44
Use basename to get the base name of a path. Use dirname to get the path excluding base name.
For example:
basename /export/home/user123/file1 # sends ...