- x is your friend. It will let you insert some white space to add legibility. Maybe not in the one-liner, but certainly during the regex development.
- m is your friend. You've got it enabled, but are not actually using it. It's ideal for specifying the end/start of lines that you are doing with $o
- s may not be your friend in this case. If you turn off s, then . actually corresponds to the character class [^\n].
While this may not work for the full range of output in your particular case, maybe something like:
dmidecode | perl -e 'undef $/;for (split /(?<=\n)\n+/, <STDIN>) {print if /RAM socket/ && !/Not Installed/}' would work. Keep it simple.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.