Commit | Line | Data |
93a17b20 |
1 | New things |
2 | ---------- |
3 | The -w switch is much more informative. |
4 | |
463ee0b2 |
5 | References. See t/op/ref.t for examples. All entities in Perl 5 are |
6 | reference counted so that it knows when each item should be destroyed. |
93a17b20 |
7 | |
8 | Objects. See t/op/ref.t for examples. |
9 | |
10 | => is now a synonym for comma. This is useful as documentation for |
11 | arguments that come in pairs, such as initializers for associative arrays, |
12 | or named arguments to a subroutine. |
13 | |
14 | All functions have been turned into list operators or unary operators, |
15 | meaning the parens are optional. Even subroutines may be called as |
16 | list operators if they've already been declared. |
17 | |
463ee0b2 |
18 | More embeddible. See main.c and embed_h.SH. Multiple interpreters |
19 | in the same process are supported (though not with interleaved |
20 | execution yet). |
93a17b20 |
21 | |
22 | The interpreter is now flattened out. Compare Perl 4's eval.c with |
23 | the perl 5's pp.c. Compare Perl 4's 900 line interpreter loop in cmd.c |
24 | with Perl 5's 1 line interpreter loop in run.c. Eventually we'll make |
25 | everything non-blocking so we can interface nicely with a scheduler. |
26 | |
27 | eval is now treated more like a subroutine call. Among other things, |
28 | this means you can return from it. |
29 | |
30 | Format value lists may be spread over multiple lines by enclosing in |
85e6fe83 |
31 | a do {} block. |
93a17b20 |
32 | |
33 | You may now define BEGIN and END subroutines for each package. The BEGIN |
34 | subroutine executes the moment it's parsed. The END subroutine executes |
35 | just before exiting. |
36 | |
37 | Flags on the #! line are interpreted even if the script wasn't |
38 | executed directly. (And even if the script was located by "perl -x"!) |
39 | |
40 | The ?: operator is now legal as an lvalue. |
41 | |
42 | List context now propagates to the right side of && and ||, as well |
43 | as the 2nd and 3rd arguments to ?:. |
44 | |
45 | The "defined" function can now take a general expression. |
46 | |
47 | Lexical scoping available via "my". eval can see the current lexical |
48 | variables. |
49 | |
50 | Saying "package;" requires explicit package name on global symbols. |
463ee0b2 |
51 | |
52 | The preferred package delimiter is now :: rather than '. |
53 | |
54 | tie/untie are now preferred to dbmopen/dbmclose. Multiple DBM |
55 | implementations are allowed in the same executable, so you can |
56 | write scripts to interchange data among different formats. |
57 | |
58 | New "and" and "or" operators work just like && and || but with |
59 | a precedence lower than comma, so they work better with list operators. |
60 | |
61 | New functions include: abs(), chr(), uc(), ucfirst(), lc(), lcfirst() |
62 | |
8990e307 |
63 | require with a bare word now does an immediate require at compile time. |
64 | So "require POSIX" is equivalent to "BEGIN { require 'POSIX.pm' }". |
65 | |
66 | require with a number checks to see that the version of Perl that is |
67 | currently running is at least that number. |
68 | |
69 | Dynamic loading of external modules is now supported. |
70 | |
71 | There is a new quote form qw//, which is equivalent to split(' ', q//). |
72 | |
73 | Assignment of a reference to a glob value now just replaces the |
74 | single element of the glob corresponding to the reference type: |
75 | *foo = \$bar, *foo = \&bletch; |
76 | |
77 | Filehandle methods are now supported: |
78 | output_autoflush STDOUT 1; |
79 | |
80 | There is now an "English" module that provides human readable translations |
81 | for cryptic variable names. |
82 | |
83 | Autoload stubs can now call the replacement subroutine with goto &realsub. |
84 | |
85 | Subroutines can be defined lazily in any package by declaring an AUTOLOAD |
86 | routine, which will be called if a non-existent subroutine is called in |
87 | that package. |
88 | |
85e6fe83 |
89 | There is now a pragma mechanism, using the keywords "aver" and "deny". |
90 | Current pragmas are "integer" and "strict". Unrecognized pragmas |
91 | are ignored. |
92 | |
463ee0b2 |
93 | Incompatibilities |
94 | ----------------- |
95 | @ now always interpolates an array in double-quotish strings. Some programs |
96 | may now need to use backslash to protect any @ that shouldn't interpolate. |
97 | |
98 | s'$lhs'$rhs' now does no interpolation on either side. It used to |
99 | interplolate $lhs but not $rhs. |
100 | |
101 | The second and third arguments of splice are now evaluated in scalar |
102 | context (like the book says) rather than list context. |
103 | |
104 | Saying "shift @foo + 20" is now a semantic error because of precedence. |
105 | |
106 | "open FOO || die" is now incorrect. You need parens around the filehandle. |
107 | |
108 | The elements of argument lists for formats are now evaluated in list |
109 | context. This means you can interpolate list values now. |
110 | |
111 | You can't do a goto into a block that is optimized away. Darn. |
112 | |
113 | It is no longer syntactically legal to use whitespace as the name |
114 | of a variable. |
115 | |
116 | Some error messages will be different. |
117 | |
118 | The caller function now returns a false value in a scalar context if there |
119 | is no caller. This lets library files determine if they're being required. |
120 | |
121 | m//g now attaches its state to the searched string rather than the |
122 | regular expression. |
123 | |
124 | "reverse" is no longer allowed as the name of a sort subroutine. |
125 | |
126 | taintperl is no longer a separate executable. There is now a -T |
127 | switch to turn on tainting when it isn't turned on automatically. |
128 | |
ed6116ce |
129 | Symbols starting with _ are no longer forced into package main, except |
130 | for $_ itself (and @_, etc.). |
131 | |
8990e307 |
132 | Double-quoted strings may no longer end with an unescaped $ or @. |
133 | |
134 | Negative array subscripts now count from the end of the array. |
135 | |
136 | The comma operator in a scalar context is now guaranteed to give a |
137 | scalar context to its arguments. |