... 358
10 .8 Summary 360
Directions for further study 3 61
11 Subroutines and variable scoping 362
11 .1 Compartmentalizing code with subroutines 363
Defining and using subroutines 365 ✦ Understanding ... collect and process input
6
Further details on creating Perl commands and scripts are provided in sections 2 .1 and 2.4.
xii
5 Perl as a (better) awk command 12 1
5 .1 A brief history of AWK 12 2
5.2 ... Haimes
ISBN 1- 932394-50-8
Printed in the United States of America
12 345678 910 –VHG 10 09080706
xxiv
Part 1: Perl for UNIXandLinux users
Part 1 gives those with at least user-level Unix skills—which...
... established books (e.g.,
Zeng, 19 84; Mai and Tang, 19 97), (When
completed, there will be around 10 ,000 word
entries) and a handful of rules. A Cantonese-
Mandarin dialect corpus is also being ... proper place of men and
machines in language translation.
Machine
Translation, 1- 2 /12 , pp. 3-23.
Martin K. (19 97b)
It's still the proper place.
Machine
Translation, 1- 2 /12 , pp. 35-38. ... "Language
Engineering", L. Chen and Q. Yuan, ed., Tsinghua
University Press, Beijing, China, pp. 389-395.
14 64
Dialect MT: A CaseStudy between Cantonese and Mandarin
Xiaoheng Zhang
Dept....
... scalars 210
Using split 211 ✦ Using localtime 214 ✦ Using
stat 215 ✦ Using chomp 219 ✦ Using rand 2 21
7.3 Programming with functions that process lists 223
Comparing Unix pipelines and Perl ... tables xxxv
Part 1 Minimal Perl: for UNIXandLinux Users 1
1 Introducing Minimal Perl 3
1.1 A visit to Perlistan 3
Sometimes you need a professional guide 5
1. 2 Perl can be simple 7
1. 3 About Minimal ... Guidelines: the
phone_home2 script 384
11 .5 Reusing a subroutine 386
11 .6 Summary 387
Directions for further study 387
12 Modules and the CPAN 388
12 .1 Creating modules 389
Using the Simple...
... in the house 10
1.1 .1. 2. Ancestors worship 12
1.1 .1. 3. Worship of the village 14
1. 1.2. The Mother Goddess religion (Dao Mau) in Vietnam 15
1. 1.2 .1. Goddess worship 16
1. 1.2.2. The cult of ... VIETNAM AND THE CLASSIFICATION OF GUT AND LEN
DONG 9
1.1. Foundation of individual Gut in Korea and Holy Mother in VietNam 9
1.1 .1. Shamanism of Korea 9
1.1 .1. 1. Worship the gods in the house 10 ...
2
1. 2 .1. 1. Thanh Dong 21
1. 2 .1. 2. Dong Co 23
1. 2.2. Gut classification of Korea 25
1. 2.2 .1. National Gut 27
1. 2.2.2. Village Gut 28
1. 2.2.3. Individuals Gut and SenamGut 31
CHAPTER...
...
area for the pre- and post-filling phases 55
Figure 3 .12 Catches in the three areas during the pre-filling phase (19 81) and post-filling phase
(19 88, 19 89 and 19 98) 56
Figure 3 .14 Relative share ... region in 19 88, 19 89 and 19 98 57
Figure 3 .15 Relative proportions of the main species caught for commercial purposes in the
reservoir region in 19 88, 19 89 and 19 98. 58
Figure 3 .16 Relative ... 2.2 Pará and Carajás Map 11
Figure 2.3 Tucuruí Hydropower Complex Reservoir 12
Figure 2.4 Cities flooded by Tucuruí Dam and resettlement areas 13
Figure 2.5 Transmission Lines Layout 13
Figure...
... -l)67
3.9 Using matching modifiers 68
3 .10 Perl as a better egrep 70
3 .11 Matching in context 75
3 .12 Spanning lines with regexes 77
3 .13 Additional examples 81
3 .14 Summary 86
This chapter shows you ... commands and small Perl scripts
that surpass the limitations of the
UNIX grep command. We’ll start by reviewing
grep’s history, strengths, and weaknesses, and Perl’s superior features, and then ... mid 19 80s, when implementations started appearing for
non-
UNIX systems—including versions of the humble DOS.
STANDARD OPTION CLUSTERS 45
Table 2.9 Standard option clusters for Perl commands and...
... incomplete" and
$count=$count
+ 1;
Table 5.8 AWK and Perl programs for simple tasks
AWK
a
Perl
b
Explanation
1 <= NR && NR <= 3 1 <= $. and $. <= 3
and print;
Prints records 1 ... PERL AS A (BETTER) awk COMMAND
$ sed -n l X
Birth\t\tDeath\t\tName$
11 /20/46\t10/29/ 71\ tDuane Allman$
1 2 3
1 2 3 4
The \t sequences reveal tabs between the date and name fields, confirming ... these examples:
24
[Fri Aug 18 13 :35: 41 2006]
[error] [client 12 7.0.0 .1] File doesn't exist: /shruti.htm
[Thu Oct 19 03:03:07 2006]
[error] [client 12 7.0.0 .1] File doesn't exist: /html/nsiislog.dll
One...
... invocation
9 $amount and $rate or warn "$Usage\n" and exit 255;
10
11 $pct_rate=$rate /10 0; # 5 becomes .05
12 $multiplier =1 + $pct_rate; # .05 becomes 1. 05
13 # Instruct user
14 print "Press ... enhanced script:
$ compound_interest2 -amount =10 0 -rate =10
Press <ENTER> to see $10 0 compound at 10 %.<ENTER>
$11 0 after 1 year<ENTER>
$12 1 after 2 years
Listing 5.5 shows the enhanced ... an Oscar and a Felix
on hand.
In your own career, I’d advise you to develop an appreciation and an aptitude for
both the quick -and- dirty and elegant -and- formal styles of programming, and to culti-
vate...
... argument, loaded by -n loop
11
12 $@ ne "" and warn $@; # if eval produced error, show it
13
14 printf $prompt; # print prompt for next input
15
16 END {
17 # If user pressed <^D> ... "$Usage\n" and exit 31; # 31 means no arg
$pattern=shift;
# Remove arg1 and load into $pattern
defined $pattern and $pattern ne "" or
warn "$Usage\n" and exit 27; # arg1 undefined, ... used with early UNIX shells was to process $1 and then execute
shift, and repeat that cycle until every argument had taken a turn as $1. It’s discussed in section10.2 .1.
Figure 8 .1
Effect of
shift...