---
>
> Perl doesn't have the "switch" control statement.
> But you can get it by looking at CPAN:
>
http://search.cpan.org/~rgarcia/Switch-2.13/Switch.pm
>
To share some information in the up-incoming Perl 5.10
there will be a replacement for the switch clause.
The given-when is the Perl answer to the switch
(or case) keyword in other programming languages.
It replaces Switch.pm, which was a pre-Perl 5.10
source filter that did the same thing but didn't
always
work correctly.
#!/usr/bin/perl
use feature qw(say switch);
chomp( my $var = <STDIN> );
given( $var ) {
when( /\D/ ){
say "Needs a number!"}
when( $_ == 1 ) {
say "Got 1!"
}
when( $_ == 2 ) {
say "Got 2!"
}
default {
say "You said $_"
}
} ## END given
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/