Mike Phelan writes "I was recently asked these three questions about Perl,
during an interview for a position.
1)How do you instantiate a new instance of a hash table?
2)What does $$ represent in Perl?
3)What does $! represent in Perl? "
I just hope you got them right.
Question, schmestions. Make 'em code.
chip on 2000-04-09T08:52:10
Lots of people can do well on tests but have questionable (!) coding skills. A previous employer of mine instituted a programming test in the hiring process, and as a result they had no dead weight on staff. This is a Good Thing.
Dubious first question.
Abigail on 2000-04-10T19:15:01
The second and third question are pretty straight forward, but it's totally unclear to me what they mean by the first question. "New instances" is something you expect when talking about objects, but Perl ain't Java or Python, and hash tables aren't objects. Do they perhaps want to empty a hash? (Use
()) Create a new hash? (Just use it) Copy a hash? (
%copy = %old;) Deep-copy a hash? (Can't be done in pure Perl if there are code references present, else use
Data::Dumper)
-- Abigail
going out on a limb
mphelan on 2000-04-11T19:56:38
At the risk of being hated, ridiculed, and forced to perform mime in a Parisian-themed family-style restaurant, here are "the answers" to the questions which I posed from my recent interview.
instantiate a
hash
%myHash
$!
If used in a string context,
$! yields the corresponding system error string.
$$
$$ yields the process number of the perl running the current script.
Thanks to everyone who responded. Hi Joe.
Some more Questions
malyadri on 2006-01-29T09:34:13
* What does '@' and & mean in Perl ?
* What is a 'Package' in perl?
* What are Perl Regular Expressions?
* Perl Regular Expressions are greedy. what does that mean?
* What are Associative Arrays in perl?
Re:Some more Questions
n1vux on 2006-01-30T21:57:53
Q. What are Associative Arrays in perl?
A. Obsolete nomenclature for Hashes, only called such by us ancient AWK programmers.