Hi, list!
 I know this is OT, but the Win32 list is ignoring my attempts to subscribe...

I'm working with Win32_VideoController, trying to get the VideoArchitecture method. Unfortunately, that's one of several methods that returns an unsigned integer (16 bit, in this case). Here's my question:  How can I manipulate a uint16 (or a uint32, for that matter) so that it will work as the value in a "switch" statement? That is...

for ($obj->VideoArchitecture) {
   /^(1)$/ && do { $arch = "Other", last };
   /^(2)$/ && do { $arch = "Unknown", last };
   /^(3)$/ && do { $arch = "CGA", last };
   . . .
   $arch = "Whoopsie!" ; # DEFAULT
}

When I try it, it doesn't even trip on the default!  However, it does work in the clumsy if-elsif-elsif-...-else structure:

if ($obj->VideoArchitecture == 1) {
   $arch = "Other";
} elsif ($obj->VideoArchitecture == 2) {
   $arch = "Unknown";
} ...

I'd just prefer getting the more elegant code working (mostly 'cuz it's one of my favorite Perl thingies).

Thanks!

Deane
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to