in reply to Script to scrap data
my $fecha_tramite_min = '24/11/2024'; my $fecha_tramite_max = '27/11/2024'; my $fecha_matricula_min = '01/01/1900'; my $fecha_matricula_max = '31/12/2000'; # ... if ($fecha_tramite ge $fecha_tramite_min && $fecha_tramite le +$fecha_tramite_max && $fecha_matricula ge $fecha_matricula_min && $fecha_matricu +la le $fecha_matricula_max && $prov_matriculacion eq $prov_matriculacion_filtro) {
At least one of the problems is that you are comparing dates lexically. This will not work at all where the least significant part of the date (the day of the month) comes first. eg. in your current code, any $fecha_tramite which is the 25th or 26th of any month of any year will match which is presumably not what you want.
There are any number of ways to solve this. I would reach for Time::Piece, convert all the dates into Time::Piece objects and then use the less-than and greater-than operators (< and >) to compare them.
Looking at the big picture, ensure that you have the right to extract these data sets in the first place. And if you do, consider searching for an API which would be less brittle than parsing HTML for the results.
🦛
|
|---|