Guest Posted September 5, 2006 Share Posted September 5, 2006 Exercise 1: Create an array @x such that changing $x[0] also sets $x[1] to the same value Exercise 2: Given a pre-declared function "foo", write a code snippet that invokes it in an infinite loop; in 10 chars Exercise 3a: Create $foo such that $foo->[1] == $foo->{1} Exercise 3b: Create $foo such that $foo->[1] == $foo->(1) You must use different solutions for the two Exercise 4: Dump core in 6 chars Exercise 5: Create a static variable lexically scoped to a sub, and no wider than that. It's ok if it blows up under recursion Exercise 6: Create $x, $y such that $x eq $y && $$x ne $$y Exercise 7: Create $foo such that fileno($foo) && !*$foo Exercise 8: Create $foo such that ($foo^=0)++ eq $foo++ Exercise 9a: Create $foo such that eval(q[$$foo]) != eval(q[0+$$foo]) Exercise 9b: Create $foo such that eval(q[$$foo =~ / /]) && !$$foo Exercise 10: Make $x::y::x::y::y::x::y::x::x::y::y::y::y::x::y::y true in 26 chars of code Exercise 11: Make <STDOUT> eq <+STDOUT> in 25 chars Bonus Exercise: The code snippet 'sub foo{} goto +foo' produces an error: "Can't find label SCALAR(0x31c70c)" (the address may vary) Where does that ref come from? What does it point to? Quote Link to comment Share on other sites More sharing options...
PoyBoy Posted September 6, 2006 Share Posted September 6, 2006 my perl is wuite bad Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.