Tor Hildrum wrote: > > On 17/2/02 06:01, "John W. Krahn" <[EMAIL PROTECTED]> wrote: > >> > >> open (WRITEFILE, ">$names[2]") || die ("Couldn't open $names[2] > >> for writing\n"); > > > > You should include the $! variable in your error messages. > > I don't really know what $! is. > I tried looking trough perlre, but couldn't find any explanation. > Is there a way to search the man pages for strings? Maybe a bit OT, > but reading a couple of hundred pages is time consuming.
$! is described in the perlvar document. You can search through the pod files directly, on my system they are located at /usr/lib/perl5/5.6.0/pod > >> my $counting = 0; > >> > >> while ($firstfile[$counting] ne "" || $secondfile[$counting] ne "" > >> ) { print WRITEFILE ($firstfile[$counting]); > >> print WRITEFILE ($secondfile[$counting]); > >> $counting++ > >> } > > > > while ( @firstfile or @secondfile ) { > > print WRITEFILE @firstfile ? shift @firstfile : '', > > @secondfile ? shift @secondfile : ''; > > } > > Yes, I had a feeling that $counting wasn't needed. If the first two files are large and you don't want to store the contents in arrays you can do it this way: open FIRSTFILE, "< $names[0]" or die "Couldn't open $names[0]: $!"; open SECONDFILE, "< $names[1]" or die "Couldn't open $names[1]: $!"; open WRITEFILE, "> $names[2]" or die "Couldn't open $names[2] for writing: $!"; do { my $first = <FIRSTFILE> || ''; my $second = <SECONDFILE> || ''; print WRITEFILE $first, $second; } until eof FIRSTFILE and eof SECONDFILE; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]