Questions on porting Perl from Windows to Unix
by Gary Yang other posts by this author
Jan 24 2008 11:17AM messages near this date
RE: Need help how to run java program
|
RE: Questions on porting Perl from Windows to Unix
Hi All,
I need to port my Perl script from Unix to Windows. Can someone tell me how to figure out wh
ich platform I am on? i.e. I need to know which Perl command can help me determin the platfo
rm. Once I know the platform, I'll code my script as the example bellow. But, how to figure
out I am on Windows or Unix?
if ($usingUNIX)
{
$directory = `ls`; #UNIX version.
$copyCommand = `cp`; #UNIX version.
}
else
{
$directory = `dir`; #Win32 version.
$copyCommand = `COPY`; #Win32 version.
}
Second question:
The UNIX #!/usr/bin/perl notation does not work with Perl scripts on Windows. How should I c
ode if it is Unix I place "#!/usr/bin/perl" at the very first line of the script? But, I do
not place it at the first line of code if it is not Unix? How should I do it?
Your answers are greatly appreciated.
Thanks,
Gary
---------------------------------
Never miss a thing. Make Yahoo your homepage.
Thread:
Gary Yang
Scott Campbell
Brian Raven
Wayne Simmons
Bill Luebkert
Wayne Simmons
Bill Luebkert
kenneth
Andy Bach
Curtis Leach
|