develooper Front page | perl.perl5.porters | Postings from March 2008

[PATCH] Correct misleading example in perlsyn.pod (given/when/default)

Thread Next
Paul Fenwick
March 11, 2008 19:19
[PATCH] Correct misleading example in perlsyn.pod (given/when/default)
Message ID:
G'day p5p,

While doing some writing about given/when today, I found an unfortunately 
misleading example in perlsyn.pod  Previously we had:

     given($foo) {
         when (/x/) { say '$foo contains an x'; continue }
         when (/y/) { say '$foo contains a y' }
         default    { say '$foo contains neither an x nor a y' }

However the default is still printed even when $foo contains an x (it's only 
skipped if $foo contains a y).  The attached patch makes this example less 



Paul Fenwick <> |
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About