Advertisement
hackloper775

numero-perl-giv

Feb 8th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.31 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use v5.10.0;
  4.  
  5. print "Escribe un numero del 0/4 : ";
  6.  
  7. my $n = <STDIN>;
  8.  
  9. given($n) {
  10.  
  11.  when(0) { print "Es cero\n"; }
  12.  when(1) { print "Es uno\n"; }
  13.  when(2) { print "Es dos\n"; }
  14.  when(3) { print "Es tres\n"; }
  15.  when(4) { print "Es cuatro\n"; }
  16.  default { print"Entre 0 y 4\n"; }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement