Thread perlop "eq"
(17 answers)
Opened by catweasel at 2008-08-29 21:58 catweasel+2008-08-29 21:29:37-- Das ist ein feature in Perl 5.10. z.B. so: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #! /usr/bin/perl -w use strict; use feature ':5.10'; my @array = qw/ eins zwei drei /; while ( @array ) { my $count = 1; print $count++, " ", $_, "\n" for @array; print "Auswahl: "; chomp ( my $aw = <STDIN> ); given( $aw ) { when ( 1 ) { print "eins\n\n"; } when ( 2 ) { print "zwei\n\n"; } when ( 3 ) { print "drei\n\n"; } default { exit; } } } meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen! |