Wednesday, May 1, 2019

Perl - get the script path

# C:\Foo\Bar\

use strict;
use warnings;

use FindBin qw($Bin);

print "My script lives in $Bin\n"; # My script lives in C:/Foo/Bar

Note that there is no trailing slash, and Windows back-slashes '\' are converted to forward slashes '/'

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.