in reply to if statement comparing elements of arrays?

I bet that @commands does not contain regex patterns, but you treat its contents as such.
=~ /$commands[0]/ # Matches pattern in $commands[0] =~ /\Q$commands[0]\E/ # Contains string in $commands[0] =~ /^\Q$commands[0]\E\z/ # Equals string in $commands[0] eq $commands[0] # Equals string in $commands[0]

\Q..\E is a shortcut for calling quotemeta.

And here's a solution that avoids redundancy:

if ( grep { $commands_run[$_] ne $commands[$_] } 0..$#commands ) { print "Test ---- FAIL\n"; } else { print "Test -----PASS\n"; }