Readdir and file::copy?

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Gary Yang
Sent: Thursday, January 24, 2008 2:16 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Questions on porting Perl from Unix to Windows

 

Hi All,
 
I need to port my Perl script from Unix to Windows. Can someone tell me
how to figure out which platform I am on? i.e. I need to know which Perl
command can help me determin the platform. 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 code 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
 

 

  

________________________________

Looking for last minute shopping deals? Find them fast with Yahoo!
Search.
<http://us.rd.yahoo.com/evt=51734/*http:/tools.search.yahoo.com/newsearc
h/category.php?category=shopping> 

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to