Then there must be confusion with file. How about something like this?
use warnings;
use strict;
my $in = 'file'
my $out = 'file2';
open my $OUT, '>', $out or die $!;
if (-s $in) {
open my $IN, '<', $in or die $!;
while (<$IN>) {
my $line = $_;
chomp $line;
print $OUT "$line\n";
print $OUT "you need to do this\n";
print $OUT " \n";
}
}
else {
print $OUT "There is nothing to do\n";
}
|