Escolar Documentos
Profissional Documentos
Cultura Documentos
</html>
El cual captura dos datos:
1.
2.
El cdigo supone la existencia de la rutina matchLine, que recibe una lnea de texto y devuelve un arreglo asociativo.
# line, return a hash array.
sub matchLine{
%dict = ();
$line = $_[0];
if( $line =~ m/^\[([0-9]+)\] ((.+), )?(.+); ((.+)|(http.+));(.+)\.$/ ){
$dict{"number"} = $1;
#$2 include the colon
if(defined($3)){ #some items do not have author
$dict{"author"} = $3;
}
$dict{"title"} = $4;
$dict{"editor"} = $5;
#$6 is the same than $5, by option |
#$7 is the whole options
$dict{"year"} = $8;
}else{
print "<h1>Error matching a line: $line</h1>\n";
}
return %dict;
}
mysql> CREATE DATABASE prueba;
Query OK, 1 row affected (0.03 sec)
+--------------------+
| mysql
| prueba
| test
+--------------------+
mysql> USE prueba;
Database changed
mysql> USE prueba
Database changed
mysql> CREATE TABLE gente (nombre VARCHAR(40), fecha DATE);
+------------------+
mysql> CREATE TABLE ciudad1 (nombre CHAR(20) NOT NULL, poblacion INT NULL);