Write a function that tells you which TWO of its lines has been removed In my previous code challenge, I asked you to write a function that tells you which of its lines has been removed.

The instructions were:


  Write a function that contains five lines.
  
  If you run the function as-is, it should return 0.
  
  If you remove any one of the five lines and run the function, it
  should tell you which of the lines has been removed (e.g., if you
  remove the final line it should return 5).


Now, let's try something a teensy bit more difficult.

Follow the same rules as above, but this time, the function should return an array telling you which TWO lines have been removed.

So, for instance, if I remove lines 1 and 5, the return value should be [1,5], and if I remove lines 3 and 4, the return value should be [3,4].

Again, if no lines are removed, the function should return 0.  Bonus points if you can also handle the one-line-removed case, but it's not strictly necessary that you do so.

Can you make use of helper functions?  Yes, but only if you have to.  A single self-contained function that pulls this off is the ideal.

As with the last challenge, the highest upvoted solution wins.  I'll pick the winner in a week, or sooner if no new submissions have been received in 24 hours.
Perl

sub foo {
    @a = (2..5);
    @a = grep $_ != 2, (@a ? @a : (1..5));
    @a = grep $_ != 3, (@a ? @a : (1..5));
    @a = grep $_ != 4, (@a ? @a : (1..5));
    @a = grep $_ != 5, (@a ? @a : (1..5));
}


This actually works for any number of lines removed (as long as it's not all the lines, that is), and can be trivially extended to more than 5 lines.  No helper functions are used, and it even uses only one statement per line.  It relies on the fact that, in the absence of an explicit return statement, the return value of a Perl function is the value of the last statement in it.

Note that (in list context) this code returns an empty list rather than the number 0 if no lines have been deleted.  This could be fixed (e.g. by appending "@a ? @a : 0;" to the last line), but would make the code uglier.  In any case, in scalar context it does return the number of deleted lines, which will be 0 if no lines have been removed. ;-)