in reply to Writing in reverse
Here is another way to do it using chop.
#!/usr/bin/perl -w use IO::File; my $fh1 = new IO::File; my $fh2 = new IO::File; $fh1->open("< file1.txt") or die "can't open file1.txt $!"; $fh2->open("< file2.txt") or die "can't open file2.txt $!"; my $file1 = <$fh1>; my $file2 = <$fh2>; print "Merging:\n"; print "\t$file1\n"; print "\t$file2\n"; while(length $file1){ my $couplet = chop($file1).chop($file2); print "$couplet "; }
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: Re: Writing in reverse
by Anonymous Monk on Aug 02, 2000 at 01:50 UTC | |
by Anonymous Monk on Aug 02, 2000 at 01:56 UTC | |
by Anonymous Monk on Aug 02, 2000 at 18:26 UTC | |
RE: Re: Writing in reverse
by Adam (Vicar) on Aug 02, 2000 at 01:04 UTC |
In Section
Seekers of Perl Wisdom