in reply to Suggestions for writing a Perl application

Consider what you are usually doing behind your computer. Most likely there is some job you do often, and do manually. It could be as simple as repeating the same keystrokes several times, or running a program, consulting its output, and doing something based on that output. Perhaps you repeatedly visit a website, waiting for something to happen.

My suggestion is that you automate that process. Add some useful options to it. Let it print out a usage message. Use POD to create a manual page.

Alternatively, consider the following problem. In the plane you have a set of N red points, and M blue points. Find a line such that on each side of the line, there are at most floor (N / 2) red points, and at most floor (M / 2) blue points.

But the latter might be a bit too advanced, and for most people, pretty useless.

Abigail

  • Comment on Re: Suggestions for writing a Perl application

Replies are listed 'Best First'.
Re: Re: Suggestions for writing a Perl application
by sauoq (Abbot) on Aug 28, 2003 at 21:54 UTC
    Find a line such that on each side of the line, there are at most floor (N / 2) red points, and at most floor (M / 2) blue points.

    It's easy to prove that this is impossible if either M or N has an odd number of elements. You must have meant ceil(). (Of course, that still wouldn't address the problem with infinite sets...)

    -sauoq
    "My two cents aren't worth a dime.";
    
      It's not at all impossible. Points can be on the line. If M and N are both odd, the line will go through at least one red and at least one blue point.

      Of course, that still wouldn't address the problem with infinite sets.

      In fact, it does work with infinite sets, and it works in more dimensions as well. This theorem, saying that in d dimensions, given d sets there is a hyperplane of dimension d - 1 that divides all sets in two parts of equal size, is also known as the "ham-cheese sandwich cut", because the theorem implies that you can always divide a ham-cheese sandwich in two equal parts (both parts having the same amount of ham, cheese and bread) with a single cut, even if you leave the cheese in the fridge.

      Abigail

        Oh, duh. Points on the line. Right... my mistake.

        Regarding infinite sets, I simply meant that defining the problem in terms of floor() was problematic. You avoided that in your reply by using the phrases "two parts of equal size" and "two equal parts".

        -sauoq
        "My two cents aren't worth a dime.";