Lines Matching full:when

37 value, which is anything other than C<undef>.  When used as a number,
38 C<undef> is treated as C<0>; when used as a string, it is treated as
39 the empty string, C<"">; and when used as a reference that isn't being
116 TERMs in an expression--and thus need an explicit termination when used
121 X<until> X<when> X<foreach> X<for>
133 when EXPR
164 semantics (conditional evaluated first), except when applied to a
219 The C<when> modifier is an experimental feature that first appeared in Perl
228 anywhere within the C<when> modifier's dynamic scope, but must be
250 liberally, not only when Perl would otherwise guess incorrectly.
351 increment a loop variable, even when the loop has been continued via
354 When a block is preceded by a compilation phase keyword such as C<BEGIN>,
380 last LINE if /^$/; # exit when done with header
389 For example, when processing a file like F</etc/termcap>.
480 when executed, gives:
574 to modify them will fail, consistent with the behaviour when iterating a
655 handling. The C<try> keyword introduces a block which will be executed when it
696 evaluated value when placed as the final statement in a function or a C<do>
787 body of the block is stored for later, but not invoked immediately. When the
795 warning when used.
809 The code stored by the C<defer> block will be invoked when control leaves
862 X<switch> X<case> X<given> X<when> X<default>
878 C<given>, C<when>, C<default>, C<continue>, and C<break>.
882 C<when> are analogous to C<switch> and
888 when (/^abc/) { $abc = 1 }
889 when (/^def/) { $def = 1 }
890 when (/^xyz/) { $xyz = 1 }
900 when (/^abc/) { $abc = 1 }
901 when (/^def/) { $def = 1 }
902 when (/^xyz/) { $xyz = 1 }
910 $abc = 1 when /^abc/;
911 $def = 1 when /^def/;
912 $xyz = 1 when /^xyz/;
920 $abc = 1 when /^abc/;
921 $def = 1 when /^def/;
922 $xyz = 1 when /^xyz/;
926 The arguments to C<given> and C<when> are in scalar context,
929 Exactly what the I<EXPR> argument to C<when> does is hard to describe
932 also behaves differently when lexically enclosed by a C<given> block than
933 it does when dynamically enclosed by a C<foreach> loop. The rules are far
935 on given and when"> later on.
1000 When Perl 5.12 or later encounters an ellipsis statement, it parses this
1001 without error, but if and when you should actually try to execute it, Perl
1158 =head2 Experimental Details on given and when
1163 C<when> has tricky behaviours that are expected to change to become less
1172 when (undef) {
1175 when ("foo") {
1178 when ([1,3,5,7,9]) {
1182 when ($_ < 100) {
1185 when (\&complicated_check) {
1200 C<when> or an explicit C<break>. Because it was only a copy, and because
1207 sometimes apply. Most of the time, C<when(EXPR)> is treated as an
1210 But when I<EXPR> is one of the 10 exceptional cases (or things like them)
1265 no smartmatching is done. You may think of C<when> as a smartsmartmatch.
1296 when (/^\d+$/ && $_ < 75) { ... }
1304 when ([qw(foo bar)] && /baz/) { ... }
1311 when ([qw(foo bar)] || /^baz/) { ... }
1315 when (/^baz/ || [qw(foo bar)]) { ... }
1325 when ("foo" or "bar") { ... }
1332 when ([qw(foo bar)] { ... }
1343 C<default> behaves exactly like C<when(1 == 1)>, which is
1349 C<given> block. Every C<when> block is implicitly ended with
1355 case to the next immediate C<when> or C<default>:
1358 when (/x/) { say '$foo contains an x'; continue }
1359 when (/y/) { say '$foo contains a y' }
1365 When a C<given> statement is also a valid expression (for example,
1366 when it's the last statement of a block), it evaluates to:
1377 C<when>/C<default> clause, if there happens to be one.
1389 Note that, unlike C<if> and C<unless>, failed C<when> statements always
1394 when (["pear", "apple"]) { 1 }
1395 break when "vote"; # My vote cannot be bought
1396 1e10 when /Mona Lisa/;
1414 when ("foo") { ++$count }
1423 ++$count when "foo";
1427 At the end of all C<when> blocks, there is an implicit C<next>.
1436 The Perl 5 smartmatch and C<given>/C<when> constructs are not compatible
1439 the argument to C<given()> and C<when()> (except when this last one is used
1441 control construct such as C<if()>, C<while()>, or C<when()>; they can't be
1484 In Raku, C<when()> will always do an implicit smartmatch with its