in reply to assigning system command output to a variable

system doesn't return the output of the command, it returns the exit status, as the docs say. To get the output you need to use backticks `` or qx// which are explained in more detail in perldoc perlop.

Also, = is the assignment operator. Use eq to compare strings for equality.