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.
while ... (Score:1)
Uhm, no (Score:1)
Language lawyer questions do not a good interview question make.
Re: (Score:1)
Ordinary morality is for ordinary people. -- Aleister Crowley
Re: (Score:1)
You are perfectly correct.
(Note to self: refrain from sarcasm when writing).
Re: (Score:1)
Heh. I was 40/60 on whether you were serious or not.
it's not "crypto context" (Score:2)