As your code demonstrates, doing the logic avails nothing if the syntax is wrong. Use strict and warnings as intended -- as helpers -- to get the syntax right, so you can tell if the algorithm you've selected|developed\whatever produces what you intended.
If your code won't compile, you'll never know if you've got the logic right.