Skip to content

Instantly share code, notes, and snippets.

@muraiki
Last active August 29, 2015 14:19
Show Gist options
  • Save muraiki/ed72f85a11ffac3077b1 to your computer and use it in GitHub Desktop.
Save muraiki/ed72f85a11ffac3077b1 to your computer and use it in GitHub Desktop.
merge two files
use strict;
use warnings;
open (my $foo, '<', 'foo.txt') or die;
open (my $bar, '<', 'bar.txt') or die;
open (my $merged, '>', 'merged.txt') or die;
print $merged '#!/bin/sh', "\n";
while (not eof $foo and not eof $bar) {
my $f = <$foo>;
my $b = <$bar>;
chomp($f);
chomp($b);
print $merged "$f /usr/boxes/$b\n";
}
print "Finished.\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment