Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Sunday September 05, 2004
03:58 PM

"Perl for Dumbasses" quiz, Labor Day edition

[ #20748 ]

Here's a little portability quiz for you. Why doesn't this work?

... unless $^O =~ /win/i;

For bonus points, what do you think I was trying to do (just with the conditional)?

For super bonus points, which module do you think I look in when I use $^O?

Previous Dumbass episodes: 18881, 10182, 10091.

Remember, I'm making mistakes so you don't have to!

Okay, enough Perl for today. It's time for pre-Labor Day parties.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I'm guessing you wanted to match something like 'MSWin32' and not match something like 'Darwin'.

    As to what operation you were going to skip if you weren't on Windows, my crystal ball isn't too clear. I used to skip flock on Win95/98/ME since it was (fatally) unsupported, but NT/XP etc do support flock. It's not binmode because you'd be using 'if' rather than 'unless' (or just doing it anyway on all platforms).

    • Yep, that's it. I thought I was pretty slick with that /Win/ thing, until it didn't work on my Powerbook, which sets $^O to "darwin".

      That's all. The operation I was trying to skip is no big whoop: just a test that won't work on Windows. It was the intent of the conditional that was interesting, and you got it. :)
    • Also 'cygwin'.