$fa = shift(@file_a); $fb = shift(@file_b); if (digest($fa) == digest($fb)) # digest=whatever method you prefer # use eq instead of == if digest returns a string { # files match }