sub insert_file { my $file = shift; my $path = "/home/www/artoflivingdelhi.org/$file"; unless (open(F, "<", $path)) { warn "insert_file: open of $path failed: $!"; print "\n"; } else { while () { print $_, "\n"; } # just copying what you have close(F); } }