Okay, if I'm not mistaken your "if" statement has problems. What is the difference between saying "if fork is not defined to $f" and "if $f is not defined". You fork, and then completely bypasses it. Your outputs show this - 1, then Parent equals PID (which will show because it IS the parent) and then as a normal program its shows 2,3,4. The if statement is just jumped! You don't even test within that fork. Basically you are creating a successful fork and then ignoring it with your "if" statement by having two negations to the fork. Hence why later on its starts reading itself. The parent isn't reading itself, it's just being a parent and outputting to STDOUT like any other program. I bet if you cut out the whole "if" bit you'd get the same result.
Where you have written your child process is where you parent should be, IF you have the "if" statement correct.
Hope that helps
Dean