Learning Perl Objects, References amp;amp; Modules [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Learning Perl Objects, References amp;amp; Modules [Electronic resources] - نسخه متنی

Randal L. Schwartz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید














2.10 Exercises


The answers for all exercises can be found in Section A.1.


2.10.1 Exercise 1 [30 min]


The Oogaboogoo natives on the island have unusual names for the days
and months. Here is some simple but not very well-written code from
Gilligan. Fix it up, add a conversion function for the month names,
and make the whole thing into a library. For extra credit, add
suitable error checking and consider what should be in the
documentation.

@day = qw(ark dip wap sen pop sep kir);
sub number_to_day_name { my $num = shift @_; $day[$num]; }
@month = qw(diz pod bod rod sip wax lin sen kun fiz nap dep);


2.10.2 Exercise 2 [10 min]


Make a program that uses your library and the following code to print
out a message, such as Today is
dip, sen 11,
2008, meaning that today is a Monday in August.
(Hint: The year and month numbers returned by
localtime may not be what you'd
expect, so you need to check the documentation.)

my($sec, $min, $hour, $mday, $mon, $year, $wday) = localtime;



/ 199