Ovid has asked for the wisdom of the Perl Monks concerning the following question:
Snippet 1:
sub Foo::show { print 'Foo::show' }; my %class = ( name => 'Foo' ); print qq{ $class{name}->show; #};
Snippet 2:
sub Foo::show { print 'Foo::show' }; my %class = ( 'name}' => 'Foo' ); print qq{ $class{'name}'}->show; #};
One of the above two snippets compiles. One does not. Without testing, can you tell which is which (and what, if any, output it produces) and, more importantly, why? To be fair, I can answer the first question, but not the second (I suspect that we're simply throwing too much at the Perl parser).
I think this is a bug in Perl, but perhaps it should be one of those "don't do that" sort of bugs. Thus, this is really an unfair quiz :)
Cheers,
Ovid
New address of my CGI Course.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: qq{bad quotes} quiz
by Juerd (Abbot) on Mar 08, 2004 at 22:42 UTC | |
|
Re: qq{bad quotes} quiz
by Abigail-II (Bishop) on Mar 09, 2004 at 10:30 UTC | |
|
Re: qq{bad quotes} quiz
by tinita (Parson) on Mar 08, 2004 at 22:37 UTC | |
|
Re: qq{bad quotes} quiz
by Grygonos (Chaplain) on Mar 09, 2004 at 01:11 UTC |