#!/usr/bin/perl

require "data.pl";

foreach $SELO (sort keys %database) {
    $SELOFILE = "$SELO"."_URLS";

    $ST      = 1;
    $SELO_BG = ( split('\:',$database{$SELO}) )[0];
    $KREG    = ( split('\:',$database{$SELO}) )[1];

    open FILE, ">$SELOFILE";
    for ($i=10; $i<=39; $i++) {
	$b1 = ( split('\:',$bukva{$i}) )[0];

	for ($r=10; $r<=39; $r++) {
	    $b2 = ( split('\:',$bukva{$r}) )[0];
	    $dir = $SELO;
	    $out_file = "$SELO$i$r"."_"."$ST";
    	    print FILE "http://db.infotel.bg:8889/phone/plsql/Viewfi0?ST=$ST&KREG=$KREG&FIR=$b1$b2&SEL=&CSEL=$SELO_BG&CADDRESS=&ekod_ul=&rad=0;$dir;$out_file\n";
	};
    };
    close FILE;
};
