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

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

Thread Next
From:
Paul Fenwick
Date:
March 11, 2008 19:19
Subject:
[PATCH] Correct misleading example in perlsyn.pod (given/when/default)
Message ID:
47D73DA3.8050300@perltraining.com.au
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 
misleading.

Cheerio,

	Paul

-- 
Paul Fenwick <pjf@perltraining.com.au> | http://perltraining.com.au/
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About