Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I failed to note in my earlier comment that yes, it is so much harder. Fizzbuzz requires that you write a loop, print some strings, and either maintain a couple of counters or use the modulo operator. Your solution requires:

- writing a subroutine

- understanding Perl parameter passing

- understanding Perl regexps, including =~, anchoring, alternatives, metacharacter escaping, character classes, and repeat counts;

- the ternary operator.

And then you could probe things like:

- Do they know how to fix the bug in your version where it incorrectly accepts an IP address with a newline appended to it?

- Do they know it would still work without the return and the ?1:0?

- Can they figure out that they could simplify and clarify the code substantially with qr?

- Do they understand why someone might prefer a non-regexp-based approach? :)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: