Hi, I know this may sound quite strange but I usually use JavaScript to help me debug my code.
I use the following script for checking variables:
print "<script> alert('$variable'); </script>";
it is quite effective and it pauses the script for as long as you don't click OK. This is a very good method I find, maybe too much hassle for some people though.