-
- Weitere Informationen zu diesem Buch:
Inhaltsverzeichnis | Index | Probekapitel | Rezensionen |
Beispiele |
- Weitere Informationen zu diesem Buch:
Fourth Edition August 2005
ISBN 978-0-596-10105-3
Weitere Informationen zu diesem Buch
Inhaltsverzeichnis |
Index |
Probekapitel |
Rezensionen |
Beispiele |
Index
[ Symbols ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ],
Symbols[ Top ]
@ (at sign), array referencing, 43
| (bar), regular expressions, 103
=~ (binding operator), 111
m// and, 123
^ (caret), character classes, 105
$_ default variable, 47
<> diamond operator, 70
#! line, portability, 14
.. (range operator), 41
A[ Top ]
access
array elements, 39
databases, 264
hash elements, 91
algorithms, high-water mark, 61
ampersand, subroutines, 65
anchors
regular expressions, 110
word anchors, 110
answers to exercises, 229-254
arguments
invocation, 70, 72
subroutines, 57
passing, 57
@ARGV array, 72
array slices, 224-226
arrays, 38
@ sign, 43
@ARGV, 72
bits, 266
elements, 38
access, 39
foreach control, 46
grep and, 266
indices, 40, 88
interpolation to string, 45
keys, 88
map and, 266
pop operator, 44
printf and, 77
push operator, 44
reverse operator, 47
shift operator, 45
sort operator, 48
splice operator, 266
unshift operator, 45
assigning hashes, 93
keys, 94
values, 94
assignment
binary assignment operators, 27
list values to variables, 42
scalar variables, 27
associativity, operators, 29
at sign (@), array referencing, 43
autodecrement operator, 140
autoincrement operator, 140
preincrements, 141
automatic match variables, 115
B[ Top ]
backquotes, 16
list context and, 200
output and, 198-200
bar (|), regular expressions, 103
binary assignment operators, 27
binding operator (see =~), 111
bits, arrays, 266
bitstrings, 162
bitwise operators
file tests, 160
meanings, 161
blocks
loops, labels, 148
naked, 138
Boolean values, 33
logical operators, 148
buffered output, 74
bugs, 11
built-in variables, 269
C[ Top ]
calling subroutines, 55
caret (^), character classes, 105
case, regular expressions and, 123
case-insensitive matching, regular expressions, 108
CGI (Common Gateway Interface), 268
CGI module, 258
CGI_Lite module, 258
CGI.pm module, 214
character classes, 104
shortcuts, 105
child processes, system function, 193
chmod function, 178
chomp operator, 34
closures, anonymous, 270
command line
in-place editing and, 132
options, 269
Common Gateway Interface (CGI), 268
comparison operators, 31
compiling, 15
complex numbers, 265
Comprehensive Perl Archive Network (see CPAN)
concatenation, 23
constant pragma, 262
context
lists, <STDIN> operator, 51
scalar, forcing, 51
control structures
for, 142
foreach, arrays, 46
if, 32
elsif clause, 139
last operator, 145
logical operators, 148
short-circuit operators, 149
loops, 144
naked blocks, 138
next operator, 145
partial-evaluation operators, 151
redo operator, 147
ternary operator, 150
unless, 135
else clause, 136
until, 136
while control, 35
conversions, format string, 76
converting
find command lines to Perl, 272
languages to Perl, 272
numbers to/from strings, 24
CPAN (Comprehensive Perl Archive Network), 9, 208
web site, 10
current state of Perl, 7
Cwd module, 258
D[ Top ]
data structures, complex, 270
databases
access, 264
DBI module, 215
DBI module, 215
debugging, 267
default variable ($_), 47
defined function, 36
delete function, hashes, 98
deleting
directories, 176
files, 169
delimiters, s/// and, 122
diagnostics pragma, 263
diamond operator (<>), 70
die function
ext status and, 82
fatal errors and, 82
directories
creating, 176
deleting, 176
deleting files, 169
globbing, 165
alternate syntax, 166
links, 171-176
mounted volumes, 172
ownership, 178
permission modification, 178
recursive directory listing, 168
renaming files, 170
timestamps, 179
directory handles, 167
directory tree, 164
documentation, 255
embedded, 273
double-precision floating-point values, 19
double-quote interpolation, 29
dynamic loading, 271
E[ Top ]
each function, hashes, 96
ease of use, 5
elements of arrays, 38
accessing, 39
undef values, 40
else clause, unless control structure, 136
else keyword, 32
elsif clause, if control structure, 139
emacs, 12
embedded documentation, 273
embedding, 271
environment variables
PATH, 197
processes, 197
error trapping, eval and, 217-219
errors, die function and, 82
eval, error trapping and, 217-219
exec function, 196
exercise answers, 229-254
exercises, 2
numbering, 3
overview, 17
exists function, hashes, 98
exit status, 82
expressions
hash keys as, 92
list-producing, scalar context, 49
modifiers, 137
regular expressions (see regular expressions)
scalar-producing, lists, 50
external commands, 16
F[ Top ]
fatal errors
die function and, 82
trapping, 218
Fatal module, 258
file specifications, File::Spec module, 213
file tests
bitwise operators, 160
_filehandle, 162
localtime function, 160
lstat function, 158
meanings, 155
operators, 154
stat function, 158
File::Basename module, 211, 259
File::Copy module, 259
_filehandle, 162
filehandles, 78
bad, 81
closing, 82
default, 85
names, 78
opening, 79, 273
processes as, 201-203
reopening, 86
STDIN and, 84
files
deleting, 169
renaming, 170
File::Spec module, 213, 259
find command lines, converting to Perl, 272
flags, regular expressions, 108
/x, 108
floating-point literals, 19
floating-point numbers, 18
footnotes, 2
for control structure, 142
for keyword, 144
foreach control, arrays, 46
foreach keyword, 144
forking
processes and, 203
support, 274
format string conversions, 76
formats, 266
formatted output, printf and, 76
functions
chmod, 178
defined, 36
exec, 196
hashes
delete, 98
each, 96
exits, 98
keys, 95
values, 95
index, 181
join, 125
localtime, 160
lstat, 158
math, 265
modules, 212
import list, 212
sprintf, 184
stat, 158
system functions, 193
warn, 84
G[ Top ]
/g modifier (global replacements), 122
global text replacement, regular expressions and, 122
global variables, 59
globbing, 165
alternate syntax, 166
Graphical User Interfaces (GUIs), 274
greedy quantifiers, 127
grep
arrays, 266
list items and, 220
regular expressions and, 101
groups
parentheses, 103
patterns, 103
GUIs (Graphical User Interfaces), 274
H[ Top ]
handles, directory handles, 167
hash slices, 226
hashes
assignment, 93
values, 94
element interpolation, 98
elements, access, 91
functions
delete, 98
each, 96
exists, 98
keys, 95
values, 95
introduction, 88
keys
expressions, 92
unquoted, 222
reasons to use, 90
sorting by value, 189
unwinding, 93
Hello World program, 12
Here documents, 265
high-precision numbers, 265
high-water mark algorithm, 61
I[ Top ]
/i, case-insensitive matching, 108
if control structure, 32
elsif clause, 139
Image::Size module, 259
imaginary numbers, 265
import list, module functions, 212
incrementing
autodecrement operator, 140
autoincrement operator, 140
postdecrements, 141
postincrements, 141
preincrements, 141
index function, 181
indices
arrays, 40
substring location, 181
in-place editing from command line, 132
input
<> (diamond) operator, 70
standard input, 68
user, 33
installing modules, 209, 257
instructors, 3
integer literals, 19
nondecimal, 20
integer pragma, 19
integers, 18
interpolation
arrays into strings, 45
double-quote, 29
patterns and, 112
scalar variables, 28
invocation arguments, 70, 72
invoking subroutines (see calling subroutines)
I/O connections, filehandles, 78
items in lists
grep and, 220
map and, 221
K[ Top ]
keys, 88
hash assignment, 94
hashes
expressions, 92
unquoted, 222
multiple, sorting by, 190
keys function, hashes, 95
keywords
else, 32
for, 144
foreach, 144
sub, 54
L[ Top ]
labeled loop blocks, 148
large numbers, 265
last operator, 145
lexical variables, 59
blocks, 62
lib pragma, 263
libraries, 256
modules and, 257
links, directories, 171-176
symbolic links, 174
list context
backquotes and, 200
m// in, 126
list-producing expressions, scalar context, 49
lists, 38
assign values to variables, 42
context, 48
scalar-producing expressions, 50
<STDIN> operator, 51
empty parameters, 61
grep and, 220
literals, 40
map and, 221
qw shortcut, 41
slices, 222-224
literals
double-quoted string, 22
floating-point, 19
integer, 19
list, 40
single-quoted string, 21
locales, support, 274
localtime function, 160
logical operators, 148
short-circuit operators, 149
loops
blocks, labeled, 148
control structures, 144
lstat function, file tests, 158
M[ Top ]
m//
list context and, 126
regular expressions and, 107
map
arrays and, 266
list items and, 221
match variables, 113
automatic, 115
persistence, 114
matches, regular expressions
binding operator, 111
case-insensitive, 108
m//, 107
multiline text, 129
/s, 108
word anchors, 110
matching patterns, 102
math
complex numbers, 265
imaginary numbers, 265
large numbers, 265
math functions
advanced, 265
high-precision numbers, 265
metacharacters, 102
modifiers in expressions, 137
modules
CGI, 258
CGI_Lite, 258
CGI.pm, 214
Cwd, 258
DBI, 215
documentation, 208
Fatal, 258
File::Basename, 211, 259
File::Copy, 259
File::Spec, 213, 259
functions
import list, 212
limiting, 212
Image::Size, 259
installation, 209, 257
libraries and, 257
Net::SMTP, 260
online, 208
POSIX, 261
prototypes, 66
simple modules, 210
Sys::Hostname, 261
Text::Wrap, 261
Time::Local, 262
types, 208
writing, 257
modulus operator, 20
mounted volumes, 172
multiple keys, sorting by, 190
N[ Top ]
naked blocks, 138
namespaces, packages and, 256
naming variables, 26
Net::SMTP module, 260
networking
sockets, 267
System V IPC, 267
newsgroups, 10
next operator, 145
non-scalar return values, 66
non-capturing parentheses, 133
non-greedy quantifiers, 127
numbering in exercises, 3
numbers
complex, 265
converting to/from strings, 24
floating-point, 18
floating-point literals, 19
high-precision, 265
imaginary, 265
integer literals, 19
integers, 18
large, 265
non-decimal integer literals, 20
scalars, formats, 18
sprintf function and, 184
numeric operators, 20
O[ Top ]
OO programming, 270
operator overload, 271
operator precedence, 29
operators
associativity, 29
autodecrement, 140
autoincrement, 140
binary assignment operators, 27
bitwise, file tests, 160
chomp operator, 34
comparison, 31
file tests, 154
last, 145
logical, 148
modulus operator, 20
next, 145
numeric, 20
partial-evaluation, 151
range (..), 41
redo, 147
return, 64
reverse, 47
short-circuit, 149
sort, 48, 186-189
split operator, 124
string, 23
repetition, 23
substr, 182
ternary, 150
tr///, 265
option modifiers, combining, 109
output
backquotes and, 198-200
buffered, 74
formatted, printf and, 76
print( ) operator, 28
standard output, 68, 73
overloading operators, 271
ownership, directories, 178
P[ Top ]
packages, namespaces and, 256
parameters, lists
empty, 61
length, 60
parentheses, non-capturing, 133
partial-evaluation operators, 151
passing arguments to subroutines, 57
PATH environment variable, 197
patterns, 100
anchors, 110
groups, 103
interpolating into, 112
matching, 102
parentheses, 103
quantifiers, 102
general quantifiers, 116
replacement strings, 121
test code, 118
Perl
acquiring, 8
creation of, 4
current state, 7
ease of use, 5
popularity, 6
support, 9
Perl course instructors, 3
Perl identifier, 26
Perl Mongers group, 10
Perl newsgroups, 10
perldoc command, 255
permissions, directories, 178
persistence, match variables, 114
pop operator, 44
portability, #! line and, 14
POSIX module, 261
postdecrements, 141
postincrements, 141
Practical Extraction and Report Language, 3
pragmas
constant, 262
diagnostics, 263
lib, 263
strict, 263
use strict, 63
vars, 264
warnings, 25, 264
precedence, regular expressions, 117
preincrements, 141
print( ) operator, 28
printf
arrays and, 77
formatted output and, 76
printing, sprintf function, 184
private variables, subroutines, 59
processes
environment variables, 197
exec function, 196
as filehandles, 201-203
fork, 203
output, backquotes and, 198-200
shell avoidance, 195
system function, 193
program creation, 11
prototypes, 66
push operator, 44
Q[ Top ]
quantifiers, 102
general quantifiers, 116
greedy, 127
non-greedy, 127
qw shortcut, lists, 41
R[ Top ]
range operator (..), 41
receiving signals, 204
recursive directory listing, 168
redo operator, 147
references, 270
regular expressions, 100
| (bar), 103
character classes, 104
flags, 108
/x, 108
further reading, 256
introduction, 100
match variables, 113
persistence, 114
matches
binding operator, 111
case-insensitive, 108
m//, 107
multiline text, 129
/s, 108
metacharacters, 102
option modifiers, 108
combining, 109
parentheses, 133
pattern test code, 118
powerful, 127
precedence, 117
quantifiers, 102
greedy, 127
shortcuts, negating, 106
text case, 123
text file update, 129
text replacement, global, 122
text substitutions, 121
whitespace, 108
renaming files, 170
return operator, 64
return values
non-scalar, 66
subroutines, 55
reverse operator, 47
S[ Top ]
/s, any character match in regular expressions, 108
s/// (substitution operator), 121
delimiters, 122
scalar values, 18
Boolean values, 33
scalar variables, 26
assignment, 27
binary assignment operators, 27
interpolation, 28
undef, 35
scalar-producing expresisons, lists, 50
scalars, 18
context, 48
forcing, 51
list-producing expressions, 49
numbers
floating-point literals, 19
format, 18
non-decimal integer literals, 20
scope of variables, 59
security, 267
taint checking, 267
sending signals, 204
shell, avoiding, 195
shift operator, 45
short-circuit operators, 149
signals, sending/receiving, 204
simple modules, 210
single-quoted string literals, 21
slices, 222-224
array slices, 224-226
hash slices, 226
sockets, networking and, 267
sort operator, 48, 186-189
sort subroutine, 186
sorting
hashes, by value, 189
multiple keys, 190
splice operator, arrays, 266
split operator, 124
sprintf function, 184
numbers and, 184
standard error stream (STDERR), 79
standard input, 68
standard output, 68, 73
stat function, file tests, 158
STDERR (standard error stream), 79
<STDIN> operator, list context, 51
strict pragma, 263
string repetition operator, 23
strings, 21
array interpolation to, 45
bit strings, 162
concatenation, 23
converting to/from numbers, 24
double-quoted string literals, 22
format string, conversions, 76
operators, 23
single-quoted string literals, 21
sort operator, 186-189
split operator, 124
substrings
indexes and, 181
substr operator, 182
sub keyword, 54
subroutines, 54
ampersand and, 65
anonymous, 270
arguments, 57
passing, 57
calling, 55
defining, 54
modules, 66
parameter length, 60
position in file, 55
prototypes, 66
return operator, 64
return values, 55
sort subroutine, 186
variables, private, 59
substitution operator (see s///)
substrings
indexes and, 181
substr operator, 182
support, 9
symbolic links, 174
syntax extensions, 269
Sys::Hostname module, 261
system function, 193
System V IPC, 267
T[ Top ]
taint checking, 267
ternary operator, 150
text
file updates, regular expressions and, 129
regular expressions and, 121-134
case, 123
global replacements, 122
join function, 125
match multiline, 129
substitutions, 121
Text::Wrap module, 261
threads, support, 274
tied variables, 271
Time::Local module, 262
timestamps in directories, 179
tr/// operator, 265
transliteration, tr/// operator, 265
trapping errors, eval and, 217-219
U[ Top ]
undef scalar variable, 35
undef values, elements of arrays, 40
Unicode support, 274
unless control structure, 135
else clause, 136
unquoted hash keys, 222
unshift operator, 45
until control structure, 136
unwinding hashes, 93
updating multiple files, 129
use strict pragma, 63
user input, 33
user-defined functions, subroutines, 54
V[ Top ]
values
hash assignment, 94
sorting hashes by, 189
values function, hashes, 95
variables
built-in, 269
default, 47
environment
PATH, 197
processes and, 197
global, 59
lexical variables, 59
blocks, 62
list value assignment, 42
match variables, 113
automatic, 115
naming, 26
scalar
assignment, 27
interpolation, 28
scalar variables, 26
scope, 59
subroutines, private, 59
tied, 271
vars pragma, 264
vi, 12
void context, 57
W[ Top ]
warn function, 84
warnings, 24
warnings pragma, 264
while control, 35
whitespace, 13
regular epxressions and, 108
word anchors, 110
writing modules, 257
Zurück zu Learning Perl