in reply to Unable to use if condition inside foreach loop using perl?

The =~ operator applies the pattern on the right-hand side to the value on the left-hand side. This means the value on the left-hand side should be the line you are matching against. Try if($temp_line =~ /^REVISION_LOCATION:/)

Update: Added link