diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-05 18:16:00 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-05 18:16:00 +0000 |
commit | 83df6a1d65c0fba9c27c7fb715fa674b03462cf0 (patch) | |
tree | 0a054e0b4530814c38513f458ed5af5083134f14 /pod/perlfaq7.pod | |
parent | 8fc2f983bc0c066c9be215d0b6cf72814390f573 (diff) | |
download | perl-83df6a1d65c0fba9c27c7fb715fa674b03462cf0.tar.gz |
Updates on the pods related to the modules included since 5.6.
TODO: perltodo really could use major updating.
p4raw-id: //depot/perl@9998
Diffstat (limited to 'pod/perlfaq7.pod')
-rw-r--r-- | pod/perlfaq7.pod | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/pod/perlfaq7.pod b/pod/perlfaq7.pod index 0299c2d893..53d4b6baf8 100644 --- a/pod/perlfaq7.pod +++ b/pod/perlfaq7.pod @@ -657,11 +657,21 @@ where they don't belong. This is explained in more depth in the L<perlsyn>. Briefly, there's no official case statement, because of the variety of tests possible in Perl (numeric comparison, string comparison, glob comparison, -regex matching, overloaded comparisons, ...). Larry couldn't decide -how best to do this, so he left it out, even though it's been on the -wish list since perl1. +regex matching, overloaded comparisons, ...). +Larry couldn't decide how best to do this, so he left it out, even +though it's been on the wish list since perl1. -The general answer is to write a construct like this: +Starting from Perl 5.8 to get switch and case one can use the +Switch extension and say: + + use Switch; + +after which one has switch and case. It is not as fast as it could be +because it's not really part of the language (it's done using source +filters) but it is available, and it's very flexible. + +But if one wants to use pure Perl, the general answer is to write a +construct like this: for ($variable_to_test) { if (/pat1/) { } # do something |