RLIMIT_NPROC controls the total number of processes that uid can have running at once. So for example if you're doing this as the Apache user and you already have 100 processes running, setting a limit of 100 will stop you from creating any new processes.
At least, that's how it's supposed to work.
Comment on Re: BSD::Resource and RLIMIT_NPROC on Linux
OK, got it. So the total number of processes is counted for all existing processes, not just the new/child processes. My test script failed because even when I set $soft and $hard to 100, I have already more than 100 processes lying around at that time, so I cannot make new processes. And when I set $soft larger than $hard (e.g. $soft=2 and $hard=1), the behaviour becomes... well, let's say undefined, since it's not described in the manpages.