in reply to @ Regular Expression

Nearly! Try
my ($machine_class) = $str =~ /MACHINE_CLASS=\s*(\w*)/;