1 Replies - 1729 Views - Last Post: 08 January 2008 - 11:06 PM

#1 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6818
  • View blog
  • Posts: 31,415
  • Joined: 10-May 07

Detect & display the current Operating System

Posted 02 January 2008 - 07:09 AM

Description:
#!/usr/bin/perl
# Written by #2pencil for Dream In Code 01/02/2008

$os_= $^O;

# Here you could perform any testing operations on the result
# For example :

if($os_=="MSWin32") {
	print "Using Microsoft Windows:n";
}
else {
	print $os_;
}


Is This A Good Question/Topic? 0
  • +

Replies To: Detect & display the current Operating System

#2 KevinADC   User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: Detect & display the current Operating System

Posted 08 January 2008 - 11:06 PM

You should test your code before posting it. This will always be true: if($os_=="MSWin32") because you used the wrong operator "==".
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1