use Cwd; use FindBin qw($RealBin); $this_proc = $0; # Get name of this program $this_proc =~ s#.*\\##; # Just the name.ext $this_proc_path = $0; # Dir. path $this_proc_path =~ s#$this_proc##; $this_proc = $0; # Get name of this program $this_proc =~ s#.*\\##; $this_proc =~ s/\.pl//ig if ($this_proc =~ /\.pl/); $this_proc =~ s/\.exe//ig if ($this_proc =~ /\.exe/); printf("\$this_proc: $this_proc\n"); printf("\$this_proc_path: $this_proc_path\n"); printf("\$RealBin: $RealBin\n"); #### $this_proc: P.PL $this_proc_path: C:\tmp\ $RealBin: C:/tmp #### $this_proc: p $this_proc_path: $RealBin: C:/tmp #### perlapp --norunlib --clean --force --exe p.exe --perl C:\Perl\bin\perl.exe p.pl