sthomson has asked for the wisdom of the Perl Monks concerning the following question:

I'm a newbie, and struggling to understand some basic functions here. This statement isn't working, and I don't unstand why. Is there some operation of the foreach statement that is stopping my elsif from working properly? I've provided extra whitespace for easier digestion. I'm using Win32::Registry, as I can barely understand it at this point.
foreach (@vals) { $SubKey->GetValues(\%cvalues); if ($cvalues{'Server'}[2] =~ NT-PRINT1) {print "something\n"}; elsif ($cvalues{'Server'}[2] =~ NT-PRINT2) {print "another thing\n"}; }