#/usr/bin/perl # call this with perl prog.pl output_file input.db my $output = shift; # remove output_file from @ARGV open(OUTPUT, ">", $output) or die "Can't open $output: $!"; $/="//\n"; # now read from the remaing files in @ARGV (or STDIN) # and let perl handle the opening ... while (<>) { # do something } #### # to be inserted into the while loop above my @lines = split /\n/, $_;