Author(s): Keith Bradnam; Ian Korf
Edition: draft
Publisher: Cambridge University Press
Year: 2012
Language: English
Pages: 375
City: Cambridge
Unix and Perl to the Rescue!......Page 1
Contents......Page 5
1.1 Introduction......Page 9
1.2 How to use this book......Page 11
2.1 What do I need in order to learn Unix and Perl?......Page 14
2.2 Installing Linux on a PC......Page 16
2.3 Installing a code editor......Page 17
3.2 The Unix terminal......Page 19
3.3 The Unix command prompt......Page 21
3.4 Your fi rst Unix command......Page 22
3.5 The hierarchy of a Unix fi lesystem......Page 25
3.6 Finding out where you are in the fi lesystem......Page 27
3.7 How to navigate a Unix fi lesystem......Page 28
3.8 Absolute and relative paths......Page 30
3.9 Working with your home directory......Page 31
3.10 The Unix shell......Page 33
3.11 Environment variables......Page 34
3.12 Introduction to command-line options......Page 36
3.13 Man pages......Page 40
3.14 Working with directories......Page 43
3.15 The importance of saving keystrokes......Page 45
3.16 Moving and renaming fi les......Page 50
3.17 Moving and renaming directories......Page 54
3.18 How to remove fi les......Page 55
3.19 How to copy fi les and directories......Page 57
3.20 Working with text fi les......Page 61
3.21 Introduction to aliases......Page 64
3.22 Editing text fi les......Page 68
3.23 Automating Unix commands......Page 71
3.24 How to hide fi les and fi nd hidden fi les......Page 74
3.25 Creating a confi guration fi le......Page 76
3.26 Programming with Unix......Page 81
3.27 Unix fi le permissions......Page 82
3.28 How to specify which directories contain programs......Page 85
3.29 Creating useful shell scripts......Page 89
3.30 Unix summary......Page 91
4.1 Hello world......Page 93
4.2 Scalar variables......Page 95
4.3 Use warnings......Page 99
4.4 Maths and functions......Page 102
4.5 Perl vs. perl......Page 108
4.6 Conditional statements......Page 109
4.7 Use strict......Page 116
4.8 Stopping programs......Page 122
4.9 Working with strings......Page 124
4.10 Dealing with special characters......Page 130
4.11 Matching operators......Page 132
4.12 The transliteration operator......Page 138
4.13 List context......Page 142
4.14 Introduction to Arrays......Page 144
4.15 Array manipulation......Page 150
4.16 The @ARGV array......Page 156
4.17 Defi ned and undefi ned variables......Page 160
4.18 Sorting......Page 162
4.19 Introduction to loops......Page 166
4.20 More loops......Page 170
4.21 Loop control......Page 174
4.22 Data input and output......Page 179
4.23 Reading and writing fi les......Page 184
4.24 Introduction to hashes......Page 190
4.25 Working with hashes......Page 195
4.26 Introduction to regular expressions......Page 199
4.27 Regular expression metacharacters......Page 201
4.28 Working with regular expressions......Page 209
4.29 Interacting with other programs......Page 214
4.30 Using functions and subroutines......Page 219
4.31 Returning data from a subroutine......Page 223
4.32 Part 4 summary......Page 227
5.1 Introduction to advanced Unix......Page 228
5.2 Introduction to process control......Page 231
5.3 The grep command......Page 237
5.4 Viewing and controlling program output......Page 242
5.5 Redirecting input and output......Page 243
5.6 Standard error......Page 249
5.7 Connecting commands with pipelines......Page 251
5.8 Advanced text manipulation......Page 255
6.1 Regular expressions revisited......Page 260
6.2 Function libraries......Page 264
6.3 References and two-dimensional arrays......Page 270
6.4 Records and other hash references......Page 277
6.5 Using references with subroutines......Page 282
6.6 Complex data structures......Page 283
6.7 Adding command-line options......Page 289
6.8 OOP basics......Page 294
6.9 CPAN......Page 300
7.1 Debugging strategies......Page 304
7.2 Common error messages......Page 309
7.3 Code beautifi cation......Page 313
7.4 Abstraction......Page 319
7.5 Data management......Page 325
7.6 Documentation......Page 333
7.7 Revision control......Page 338
7.8 Working with other people’s data......Page 341
7.9 Getting help......Page 345
Appendix......Page 350
Index......Page 366