My favorite question from that pool was "How would you parse a CSV input?" , the answer of course being.. "Don't!, use Text::CSV and get on with your life."
I've had the same general philosophy overall, but strangely enough that's rarely the answer employers are looking for. So I've come up with a multipart response:
- Ask for more details about the CSV being input. Ask the clever things like what types of values could be in the string, what's the encoding, are paired quotes acceptable, is the first row a header, and anything else I think of.
- Tell them my first choice would be to use Text::CSV - or if my memory is sharp that day, I'd mention a few of the variants. I'd also try to show them an example of usage appropriate to the information I gathered in part one.
- Then, in the inevitable case where they look at me with that "Yes yes, but what if a sniper takes a shot at you every time you load cpan?" look, I'd try to sort through the solution just with core components. It's tedious, and I'd prefer to not take a job where using CPAN was a capital offense. Then again, just looking at it as a problem-solving exercise makes the interview kind of fun. And really, after enough interviews, I'm looking for any way to make them more pleasant experiences.