Advertisement
hackloper775

given-perl

Feb 8th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.58 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use v5.10.0;
  4.  
  5. print "Cual es el nombre de tu distribucion de Linux : ";
  6.  
  7. my $sistema=<STDIN>;
  8.  
  9. chop($sistema);
  10.  
  11. given( $sistema ) {
  12.     when('ubuntu') { print "Eres ubuntero :)\n"; }
  13.     when('debian') { print "Eres Debianita :D\n"; }
  14.     when('archlinux') { print "O: Archero\n"; }
  15.     default { print "Usas $sistema\n"; }
  16. }
  17.  
  18. print "Otra prueba :D\n";
  19.  
  20. print "Escribe un numero : ";
  21.  
  22. my $numero=<STDIN>;
  23.  
  24. given($numero) {
  25.     when(/\d/) { print "Bien solo escribiste numeros numeros :D\n"; }
  26.     when(/\D/) { print "Solo numeros |:(\n"; }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement