I just spent a while chasing a stupid bug. I have an big log directory that I have to clean up. The number of files caused the shell's wildcard expansion to fail. So I wrote some perl to move things around.
And it didn't do anything. To cut a long story short, I needed the total number of files in the directory. So I had something along the lines of:
perl -le 'print scalar(glob("*"))'
That does not return the number of files. It returns the name of the first file. Or the last. I don't care.
You have to force array context and throw it away:
perl -le 'print scalar(()=glob("*"))'
This prints 31192. I wish Perl didn't do this. Nice interview question though, I guess.