You are not logged in.

#1 2017-09-20 11:18:09

garry
Administrator
Registered: 2017-07-29
Posts: 115

Multipliaction tables program

perl-tmb.gif

The basic script:

#!/usr/bin/perl
#use strict;
#use warnings;

print "Por favor escribe tu nuombre:\n";
$name = <>;
chomp($name);
print "Hola!, ", $name, "!\n";
print " $name, Vamos a hacer tablas ,tecla algunas letras o numeros:\n";
$string = <>;
chomp($string);
print "Lo que teclado,tiene:\n",length($string),"  letras o numeros\n";
$_= <STDIN>;
print "[Instrucciones, ctrl-c o \"quit\" para salir]\n";
print "Entra para continuar\n";
$_ = <STDIN>;
OUTER: {
    my ($x, $y) = map { int rand $_ } qw/11 11/;
    INNER: {
        print "$x x $y = ";
        local $_ = <STDIN>;
        chomp;
        last OUTER if m/^quit$/;
        redo INNER unless m/^\d+$/;
        if ($_ == ($x*$y))
  { print "Muy buen es correcto!\n"; redo OUTER }
        else
          { print "Oops!No es correcto,haga otra vez\n"; redo INNER }

    }
}

Offline

Board footer

Powered by FluxBB