|No such thing as a small change|
Re: RFC: Self Assessment Perlby eyepopslikeamosquito (Chancellor)
|on Sep 07, 2018 at 07:33 UTC||Need Help??|
See On Interviewing and Interview Questions for how I used to go about interviewing.
Further to that, I've dug out some old Perl interview questions I used to assess candidates who said they "knew" Perl (to keep them honest). That is, these questions are not difficult for a Perl expert.
Given a list of numbers, namely:
write some code to add 42 to every item in this list, producing a new list. For this example data, newlist should contain the values: ( 46, 49, 50 ). Sample answer:
Given a string containing a space-separated list of names:
write some code to produce a frequency table of names, sorted descending by frequency, then ascending by name. For this data, the output should be:
Given an input text file and an output file as follows:
write some code to read infile and change all occurrences of 'Peking' to 'Beijing', leaving infile unchanged and writing the changed text to a new file outfile. Sample answer:
If they use s/Peking/Beijing/g contrast with s/\bPeking\b/Beijing/g and ask which they prefer.
Updated: Added \b assertions to s/Peking/Beijing/ and extra questions around regex assertions. Thanks haukex.