in reply to File Input and Output

Also if a file doesn't exisit the following code will generate the file on the server although I can't figure out why:
open(file, ">$filename") flock file, 2; print file "Whatever you want to say"; close(file);
And after that it generates a file on the server, could someone explain it for me?