+ return @sortedfiles;
+}
+
+# Levanta una variable del archivo AFINSTAL.CONF
+sub getConfVar {
+ $CONFIGFILE = shift;
+ $linenumber = shift;
+ open(CONFIGFILE) or die "No se pudo abrir el archivo $CONFIGFILE";
+ do { $line = <CONFIGFILE> } until $. == $linenumber;
+ close(CONFIGFILE);
+ chop($line);
+ ($confvar = $line) =~ s/^.*= (.*)/$1/;
+ return $confvar;
+}
+
+# Agrega un log entry al logfile del antifraude.pl
+sub logEntry {
+ $logentry = shift;
+ $log = "$CONFDATA{logdir}/$CONFDATA{logfile}";
+ # Fetch date and Format it
+ ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time);
+ $year += 1900; $year = sprintf("%02d", $year % 100); ++$mon;
+ $user = getlogin || "Unidentified";
+ $commonstring = "[$mday/$mon/$year $hour:$min:$sec|$user|antifraude]";
+ # Append to log
+ open(LOGFILE,">>$log") or die "No se pudo abrir el archivo de log";
+ seek(LOGFILE,0,2);
+ print LOGFILE "$commonstring - $logentry";
+ close(LOGFILE);