Change output if file is empty

I'm very new to writing scripts, so here is my problem...I have the following code already written (in perl)

system "rm file2";
open(FILE2, ">file2");
open(MYINPUTFILE, "file");

while(<MYINPUTFILE>) {
my($line) = $_;
chomp($line);
print file2 "$line\n";
print file2 "just a line\n";
print file2 " \n";
}

what I want it to do also is that if the input file is empty, write "There is nothing to do" instead of what it is printing now, but still print it into the same file. Any ideas?

to check that the file exists and is of zero size:

if (-e $filename  and  -z $filename) {
    print "file $filename exists and is of zero size\n";
}

ok, so I modified the code to what I have below. The problem is that it no always prints "message here", even if the file is not empty.

 
system "rm file2";
open(FILE2, ">file2");
 
open(MYINPUTFILE, "file");
 
if ( ! -s file ){
 print FILE2 "message here\n";
 } else {
 while(<MYINPUTFILE>) {
  my($line) = $_;
  chomp($line);
  print FILE2 "$line\n";
  print FILE2 "just a line\n";
  print FILE2 " \n";
 }
}

Any ideas?