in reply to backticks on windows (ActiveState)
Update: jacques below has mentioned about File::Spec::Functions, which is a cleaner approach than using Win32::AbsPath. Here's an example using the File::Spec::Functions module -use strict; if ($^O eq "MSWin32") { require Win32::AbsPath; # load Win32::AbsPath if under Windows } sub NormalizePath # normalize/fix the path { # if on a Windows platform my $path = shift; $path = Win32::AbsPath::Fix $path if $^O eq "MSWin32"; return $path; } my $command = NormalizePath('C:/Windows/System32/cmd.exe'); my $dir = `$command /C dir`; print "$dir";
use strict; use File::Spec::Functions; my $command = canonpath('C:/Windows/System32/cmd.exe'); my $dir = `$command /C dir`; print $dir;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: backticks on windows (ActiveState)
by jacques (Priest) on Nov 26, 2003 at 02:11 UTC | |
|
Re: Re: backticks on windows (ActiveState)
by christineandbucket (Initiate) on Nov 26, 2003 at 20:53 UTC |