use strict; use warnings; use Cwd 'abs_path'; use File::Basename; my $script_dirname = dirname(abs_path($0)); print "dirname: $script_dirname\n";
Output
C:\Data\scripting\misc>path_test.pl dirname: C:/Data/scripting/misc C:\Data\scripting\misc>perl path_test.pl dirname: C:\Data\scripting\misc C:\Data\scripting\misc>
Just a bit strange for me that it change / to \ when using the interpreter ...
In reply to Re: Windows - dirname(__FILE__)
by demichi
in thread Windows - dirname(__FILE__)
by demichi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |