亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? revisit.pl

?? Linux程序設(shè)計(jì)(原書第2版)BeginningLinuxProgrammingLinux 程序設(shè)計(jì)(原書第2版)BeginningLinuxProgrammingLinux程序設(shè)計(jì)(原書第2版)B
?? PL
字號:
#! /usr/bin/perl -w# Perl translation of chapter 2's shell CD database# Copyright (C) 1999 Wrox Press.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.# You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-#1307 USA# We'll place the whole of the program here, and flesh out the functions later.use MLDBM qw(AnyDBM_File);my $record;tie(%tmp, "MLDBM", "cddb.db")or die "Couldn't tie DB.\n"; # Scary complex hash contains the whole DB.%database = %tmp; # Overcome a limitation in MLDBM. *sigh*# Tidy up nicely$SIG{INT} = sub { %tmp = %database; untie %tmp } ;system("clear");print "\n\nCD Database Manager\n\n";while (1) {    my $menu_choice = main_menu($record);    if ($menu_choice eq "a") { $record = add_cd(); }    elsif ($menu_choice eq "r") { remove_cd($record); undef $record; }    elsif ($menu_choice eq "f") { $record = find_cd("y"); }    elsif ($menu_choice eq "u") { update_cd($record); }    elsif ($menu_choice eq "c") { count_cds(); }    elsif ($menu_choice eq "l") { list_tracks($record); }    elsif ($menu_choice =~ /q/i) { last; }    else {        print "Can't get here.\n";    }}%tmp=%database;untie %tmp;# Now we display the main menu and validate the choice.sub main_menu {    my $record = shift;    my $choice;    my $title = $database{$record}->{title} if $record;    print <<EOF;        Options :        a) Add new CD        f) Find CD        c) Count CDs and tracks in the catalogueEOF        if ($record) {        print "   l) List tracks on $title\n";        print "   r) Remove $title\n";        print "   u) Update entry for $title\n";    }    print "   q) Quit\n";    print "Your choice: ";    while (1) {        $choice=lc(<>);        substr($choice,1)="";        # Now, we see if the choice is contained in the string of        # acceptable options, (Which includes l, r and u if we've        # selecetd a record.) by using it as a regexp. Looks weird?        return $choice if ("afcq".($record?"lru":"") =~ /$choice/);        # If not, that's invalid        print "Invalid choice.\nTry again: ";    }}# Let's tackle adding records to the database next. The database is actually# quite a complicated hash; the keys are the catalog numbers, and the values# are each themselves hashes. These hashes have keys "title", "type", "artist",# and "tracks". That's why we used the funky-looking $database{$record}->{title}# above - $database{$record} is a hash (it's actually a reference to a hash;# C programmers can think of them as pointers. For more about reference, look# at the perlref documentation) and the ->{title} syntax looks inside the hash# reference and gets the value of the "title" key. The value of "tracks" is,# of course, a reference to an array of tracks. Arrays inside hashes inside hashes.# It takes a little getting used to. sub add_cd {    while(1) {        print "Enter catalog number: ";        chomp($record=<>);        if (exists $database{$record}) {            print "Already exists. ";            print "Please enter a different number.\n";        } else {            last;        }    }        print "Enter title: ";    chomp($title=<>);        print "Enter type: ";    chomp($type=<>);    print "Enter artist/composer: ";    chomp($artist=<>);    $database{$record}= {        "title" => $title,        "type" => $type,        "artist" => $artist    };    add_tracks($record);    return $record; # Tell the main menu the new record number.}# Now the subroutine to add the tracks; this is where we bring out the array reference. sub add_tracks {    my $record = shift;    print "Enter track information for this CD\n";    print "Enter a blank line to finish.\n\n";    my $counter=0; my @tracks;    while (1) {        print ++$counter.": ";        chomp($track=<>);        if ($track) {            # @{...} means "interpret as an array"            push @{$database{$record}->{tracks}}, $track;        } else {            last;        }    }}sub find_cd {    $view = ($_[0] eq "y");    print "Enter a string to search for: ";    chomp($search=<>);    # For each key, (record) add the key to the @found array if the    # title field of that record contains the search string.    @matches = grep {$database{$_}->{title} =~/\Q$search\E/ }    keys %database;    if (scalar @matches == 0) {        print "Sorry, nothing found.\n";        return;    } elsif (scalar @matches != 1 ) {        print "Sorry, not unique.\n";        print "Found the following:\n";        foreach (@matches) {            print $database{$_}->{title}."\n";        }        return;    }    $record=$matches[0];    print "\n\nCatalog number: ".$record."\n";    print "Title: ".$database{$record}->{title}."\n";    print "Type: ".$database{$record}->{type}."\n";    print "Artist/Composer: ".$database{$record}->{artist}."\n\n";    if ($view) {        print "Do you want to view tracks? ";        $_ = <>;        if (/^y(?:es)?$/i) {            print "\n";            list_tracks($record);            print "\n";        }    }    return $record;}# Once we've got this far, listing the tracks isn't difficult! sub list_tracks {    my $record = shift;    foreach (@{$database{$record}->{tracks}}) {        print $_."\n";    }}# Updating a CD just means removing the old tracks and adding a new set.sub update_cd {    my $record = shift;    print "Current tracks are: \n";    list_tracks($record);    print "\nDo you want to reenter them?\n";    if (($_ = <>) =~ /^y(?:es)?$/i) {        # Remove the old entry from the hash        delete $database{$record}->{tracks};        add_tracks($record);    } else {        print "OK, canceling.\n";    }}# Similarly, removing a CD just means deleting its hash entry.sub remove_cd {    my $record = shift;    print "\nDo you want to delete this CD?\n";    if (($_ = <>) =~ /^y(?:es)?$/i) {        delete $database{$record};    } else {        print "OK, cancelling.\n";    }}# Finally, counting the CDs is easy - it's just the number of keys in the hash.# Counting the tracks, however, is a little more tricky; we evaluate the tracks# array in scalar context for each of the keys in the database, and add the# values together. (You could do this with map() but that would be less clear.)sub count_cds {    my $totaltracks=0;    print "Found ".(scalar keys %database)." CDs and ";    foreach (keys %database) {        $totaltracks+= scalar @{$database{$_}->{tracks}};    }    print $totaltracks." tracks.\n";}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区毛片| 国产一区二区三区观看| 欧美一级艳片视频免费观看| 五月综合激情网| 日韩一区二区中文字幕| 国产乱理伦片在线观看夜一区| 久久精品欧美一区二区三区不卡 | 激情综合色丁香一区二区| 精品99久久久久久| 色菇凉天天综合网| 久久99在线观看| 亚洲成人av一区二区三区| 久久精品亚洲精品国产欧美kt∨| 91免费观看视频| 国模少妇一区二区三区| 亚洲自拍偷拍图区| 久久久久久影视| 日韩免费电影一区| 欧美三级日韩在线| 91美女精品福利| 国产福利91精品一区| 日韩精品一级中文字幕精品视频免费观看| 欧美成人a视频| 日韩欧美一区二区免费| 欧美久久久久久蜜桃| 成人动漫精品一区二区| 国产在线播放一区三区四| 午夜精品久久久久| 午夜视频一区在线观看| 午夜精品久久久久久久99水蜜桃| 亚洲同性gay激情无套| 国产精品第一页第二页第三页| 2021久久国产精品不只是精品| 欧美一级片在线| 久久青草国产手机看片福利盒子 | 日本一区二区三区在线观看| 久久色.com| 国产精品私房写真福利视频| 中文字幕一区二区三区乱码在线| 久久精品亚洲精品国产欧美kt∨| 欧美本精品男人aⅴ天堂| 国产午夜精品一区二区三区四区| 久久蜜桃一区二区| 国产精品久久久久影院老司| 亚洲乱码日产精品bd| 日韩经典中文字幕一区| 国产毛片精品视频| 99vv1com这只有精品| 欧美一区二区在线不卡| 国产三级三级三级精品8ⅰ区| 国产精品美女一区二区三区| 亚洲视频一区二区在线观看| 日韩有码一区二区三区| 97久久超碰国产精品| 精品国一区二区三区| 一区二区三区中文字幕电影| 国产美女精品一区二区三区| 91黄色免费看| 亚洲欧美日韩在线| 国产一区二区91| 日韩欧美一区二区在线视频| 一区二区三区欧美日韩| 成人性生交大片免费看中文网站| 亚洲欧美日韩电影| 国产成人av电影在线观看| 欧美精品1区2区3区| 亚洲自拍偷拍九九九| av资源网一区| 亚洲欧洲日本在线| 成人黄色777网| 国产精品久久看| 北条麻妃国产九九精品视频| 精品99久久久久久| 精品在线免费视频| 国产精品五月天| 91网站在线观看视频| 亚洲欧洲中文日韩久久av乱码| 粉嫩嫩av羞羞动漫久久久| 久久精品网站免费观看| 国产不卡视频在线观看| 国产精品久久久久久久午夜片| 成人91在线观看| 亚洲精品国产无天堂网2021| 欧美日韩国产综合一区二区三区| 亚洲一区二区三区在线| 91精品国产综合久久精品图片 | 17c精品麻豆一区二区免费| 成人a区在线观看| 亚洲午夜精品在线| 久久综合色综合88| 91福利视频久久久久| 久久精品国产一区二区三| 国产精品国产三级国产普通话99 | 在线观看一区二区视频| 久久精品国产成人一区二区三区 | 欧美色手机在线观看| 狠狠久久亚洲欧美| 午夜视频在线观看一区二区三区| 精品国产乱码91久久久久久网站| 99精品欧美一区| 久久99国产精品尤物| 天天亚洲美女在线视频| 国产精品久久久久永久免费观看 | 69堂成人精品免费视频| 国产精品一区二区男女羞羞无遮挡| 一区二区免费在线| 国产精品久久久久久久久快鸭 | 亚洲激情一二三区| 国产精品免费视频观看| 精品美女在线观看| 欧美一级夜夜爽| 日韩一区二区视频在线观看| 欧美丝袜丝交足nylons| 色欧美日韩亚洲| 欧美在线看片a免费观看| 91网站在线观看视频| 欧美亚洲综合色| 欧美日韩久久不卡| 欧美一区二区三区啪啪| 精品美女被调教视频大全网站| 在线不卡一区二区| 日韩三级在线免费观看| 精品久久人人做人人爽| 国产欧美日韩三区| 18成人在线观看| 日产国产高清一区二区三区| 青青草伊人久久| 国产v综合v亚洲欧| 99精品视频在线播放观看| 欧美三级中文字幕在线观看| 欧美mv日韩mv国产网站app| 久久精品男人天堂av| 亚洲成人自拍一区| 国产精品综合视频| 欧美精品视频www在线观看| 欧美成人一级视频| 亚洲一线二线三线久久久| 国产在线看一区| 欧美在线你懂的| 国产精品国模大尺度视频| 亚洲v中文字幕| 99久久精品国产精品久久| 欧美tickling网站挠脚心| 亚洲人成影院在线观看| 国产精品资源网| 日韩一区二区三区电影在线观看| 国产精品成人免费精品自在线观看| 亚洲成av人影院| 欧美四级电影在线观看| 中文字幕人成不卡一区| 国产成人日日夜夜| 日韩一区二区在线播放| 日韩在线一二三区| 欧美男男青年gay1069videost | 一色屋精品亚洲香蕉网站| 91在线观看地址| 国产蜜臀av在线一区二区三区| 久久电影网电视剧免费观看| 91精品国产乱码| 精品一区二区三区免费视频| 欧美一卡二卡在线观看| 青青草成人在线观看| 欧美成人性福生活免费看| 免费成人美女在线观看.| 日韩一区二区视频| 国产在线精品一区二区夜色| 国产日韩欧美电影| 91在线观看美女| 青草av.久久免费一区| 精品日韩一区二区| av不卡一区二区三区| 亚洲一区二区在线观看视频| 欧美精品亚洲二区| 国产成人午夜视频| 午夜欧美电影在线观看| 91精品国产综合久久精品图片| 国产精品一二三四| 午夜在线电影亚洲一区| 欧美激情在线看| 欧美一卡2卡3卡4卡| 99久久婷婷国产综合精品电影| 亚洲国产一区二区三区青草影视| 日韩午夜av一区| 欧美日韩高清影院| va亚洲va日韩不卡在线观看| 午夜视频在线观看一区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 国产欧美一区二区精品忘忧草| 精品污污网站免费看| 欧美日韩一区二区电影| 91在线观看地址| 东方aⅴ免费观看久久av| 精品一区二区av| 蜜桃视频在线一区| 日韩电影在线观看网站| 夜色激情一区二区| 亚洲精品亚洲人成人网在线播放| 国产三级三级三级精品8ⅰ区| 2021中文字幕一区亚洲| 精品日韩一区二区三区 |