in reply to dup() in perl

Take a look at the example in man perlfunc under the function "open".