Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This is a quiz. Below are 6 examples of perl "bugs" that have been reported to perl5-porters in the last 3 weeks and determined to be not bugs. One reporter, (I believe) the only perlmonk among them, had already figured out the difficulty and was providing a documentation patch to clarify things. Of the others, four are somewhat documented.

Your mission, should you choose to accept it, is to find the documentation (if any) that supports perl's actual behaviour. Or at least figure out why perl is doing what it is doing. Or at least have some fun and maybe learn something new.

use strict; use warnings; use vars '$x'; sub ok ($$) { my ($testnum, $check) = @_; if ($check) { print "ok $testnum\n"; } else { print "not ok $testnum\n" } } $x=0; { no strict 'refs'; my $x=42; my $y = 'x'; ok 1, ${$y} == 42; } ok 2, eval 'no warnings; sub Foo::INIT { 42 } &Foo::INIT();'; $x="ad"; for ($x) { /a/gc; /\Gb?/gc; ok 3, /\Gc?/gc; } ok 4, eval ' "(R)" =~ m(\(?r\)?)i '; $x=1; { my $x=2; sub x {eval '$x'} } { my $x=3; ok 5, x; } ok 6, 17.98 == 17.99 - .01;
Update: reordered the tests (before any replies) Update: verbosify ok() sub

In reply to notabug quiz by ysth

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found