yitzle wrote:
> `cat m.top.html m.mid.html m.arc.html m.bot.html > blah`
> How can this be done without a system call?
> 
> Here's my first guess:

use warnings;
use strict;

> @doc = ();

my @doc;

> for (qw/m.top.html m.mid.html m.arc.html m.bot.html/) {
>     open $FILE,"<","$root/$_";

Where is $root defined and what does it contain?  You should *ALWAYS* verify
that the file opened correctly.

      open my $FILE, '<', "$root/$_" or die "Cannot open '$root/$_' $!";

>     my @tmp = <$FILE>;
>     @doc = (@doc,@tmp);

      push @doc, <$FILE>;

>     close $FILE;
> }
> open $FILE,">","blah";

You should *ALWAYS* verify that the file opened correctly.

open my $FILE, '>', 'blah' or die "Cannot open 'blah' $!";

> print $FILE $_ foreach(@doc);

Or just:

print $FILE @doc;

> close $FILE;
> 
> Is there something I'm missing?

You could use the magical <> operator:

use warnings;
use strict;

@ARGV = qw/ m.top.html m.mid.html m.arc.html m.bot.html /;

open my $FILE, '>', 'blah' or die "Cannot open 'blah' $!";

print $FILE $_ while <>;

__END__




John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to