Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
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>;
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