ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-porters
perl-win32-porters
Re: Questions on porting Perl from Unix to Windows
by Frank Merrow other posts by this author
Jan 24 2008 12:04PM messages near this date
view in the new Beta List Site
Re: Questions on porting Perl from Unix to Windows | [PMX:VIRUS] The huge mteeorite moves to the Earth!
At 11:15 AM 1/24/2008, Gary Yang wrote:
> 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.
>      }

C:\Documents and Settings\fmerrow\My Documents\Test> type os.pl
use strict;
use warnings;

use English;

print $OSNAME . "\n";

C:\Documents and Settings\fmerrow\My Documents\Test> os.pl
MSWin32

The O'Reilly Book Programming Perl is your friend.

Frank 

_______________________________________________
Perl-Win32-Porters mailing list
Perl-Win32-Porters@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Gary Yang
maddingue
Frank Merrow
Jenda Krynicky
Frank Merrow
Frank Merrow

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved