in reply to
Compare 2 CSV files by two different column and printout
Looking at the first line of each of your file, your machine has the form "aagdbp01.mydomain.it" and your hostname the form "aagdbp01". It seems that hostname =~ m/machine/ is never going to match. So your are done with your work, the output file should simply be file1.
Or perhaps you want something like this: $machine =~ m/$hostname/. BTW, the full truth is that hostname =~ m/machine/ will actually never be executed, because (besides the defective syntax) (string1 OR string2) =~ m/subsytem/ will probably always be false for basically the same reason (if I can make sense of your data).