in reply to is this horrible?

"Horrible" is probably a too strong word. I'd use an alternative in the regex:
$os = $1 if $description =~ /(windows|linux|solaris)/i;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: is this horrible?
by Ratazong (Monsignor) on Feb 16, 2015 at 16:35 UTC

    Nice, however it is not the same as the code of the OP. Consider the following code:

    my $description = "windows and linux and solaris"; $os = $1 if ( $description =~ /(windows)/i ); $os = $1 if ( $description =~ /(linux)/i ); $os = $1 if ( $description =~ /(solaris)/i ); print $os; $os = $1 if $description =~ /(windows|linux|solaris)/i; print " $os\n";
    Rata (knowing that this special case is probably excluded by an unwritten part of the spec)