All welcome. Here is the program code:
#!/usr/bin/perl -w print "Скрипт для загрузки программ через Wine\n"; %base = (); dbmopen (%base, "wine", 0744) || die "Ошибка обкрытия DBM файла: $!"; print "Программы, которые можно запустить:\n"; foreach ( @kluch = keys %base) {print $_,"\n"}; print "Введите название программы для ее запуска или клавишу 'Q' для заполнения базы данных\n"; chomp ($komanda = <STDIN>); if ($komanda eq 'Q' || $komanda eq 'q') {while (1) {print "Заполняем базу. Введите название программы: "; chomp ($imja_progr = <STDIN>); print "Программа - $imja_progr.\nТеперь введите адрес до исполняемого файла: "; chomp ($adress = <STDIN>); print "Пpограмма - $imja_progr.\nАдрес - $adress. Если все верно - нажмите клавишку 'Y' в противном случае 'N'\n"; chomp ($proverka = <STDIN>); if ($proverka eq 'Y' || $proverka eq 'y') { %base = ("imja_progr" => "$adress", %base); dbmclose (%base); print "Ввод данных закончен.\n"} elsif ($proverka eq 'N' || $proverka eq 'n') {next}}}; foreach ( @kluch ) {if ($_ eq $komanda) {system ("wine $base{$komanda}") && exit} else { print "Ошибка\n"; next}}; dbmclose (%base);
The essence of everything is to simplify the launch of Windows programs through Wine on Linux. As planned, at the beginning of the execution of the program, all the keys to the programs go out, the set of which launches the corresponding programs. The problem is that it fails to increase the DBM-array: when you add a new element, the old (infection!) Is deleted !!!!! Please review the code, can anyone see where the error is and what the problem is ... Thanks in advance.