summaryrefslogtreecommitdiff
path: root/Changes
blob: 4dbcd46bf90c66234814bd3e1eab29c7659ba180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
New things
----------
    The -w switch is much more informative.

    References.  See t/op/ref.t for examples.  All entities in Perl 5 are
    reference counted so that it knows when each item should be destroyed.

    Objects.  See t/op/ref.t for examples.

    => is now a synonym for comma.  This is useful as documentation for
    arguments that come in pairs, such as initializers for associative arrays,
    or named arguments to a subroutine.

    All functions have been turned into list operators or unary operators,
    meaning the parens are optional.  Even subroutines may be called as
    list operators if they've already been declared.

    More embeddible.  See main.c and embed_h.SH.  Multiple interpreters
    in the same process are supported (though not with interleaved
    execution yet).

    The interpreter is now flattened out.  Compare Perl 4's eval.c with
    the perl 5's pp.c.  Compare Perl 4's 900 line interpreter loop in cmd.c
    with Perl 5's 1 line interpreter loop in run.c.  Eventually we'll make
    everything non-blocking so we can interface nicely with a scheduler.

    eval is now treated more like a subroutine call.  Among other things,
    this means you can return from it.

    Format value lists may be spread over multiple lines by enclosing in
    curlies.

    You may now define BEGIN and END subroutines for each package.  The BEGIN
    subroutine executes the moment it's parsed.  The END subroutine executes
    just before exiting.

    Flags on the #! line are interpreted even if the script wasn't
    executed directly.  (And even if the script was located by "perl -x"!)

    The ?: operator is now legal as an lvalue.

    List context now propagates to the right side of && and ||, as well
    as the 2nd and 3rd arguments to ?:.

    The "defined" function can now take a general expression.

    Lexical scoping available via "my".  eval can see the current lexical
    variables.

    Saying "package;" requires explicit package name on global symbols.

    The preferred package delimiter is now :: rather than '.

    tie/untie are now preferred to dbmopen/dbmclose.  Multiple DBM
    implementations are allowed in the same executable, so you can
    write scripts to interchange data among different formats.

    New "and" and "or" operators work just like && and || but with
    a precedence lower than comma, so they work better with list operators.

    New functions include: abs(), chr(), uc(), ucfirst(), lc(), lcfirst()

Incompatibilities
-----------------
    @ now always interpolates an array in double-quotish strings.  Some programs
    may now need to use backslash to protect any @ that shouldn't interpolate.

    s'$lhs'$rhs' now does no interpolation on either side.  It used to
    interplolate $lhs but not $rhs.

    The second and third arguments of splice are now evaluated in scalar
    context (like the book says) rather than list context.

    Saying "shift @foo + 20" is now a semantic error because of precedence.

    "open FOO || die" is now incorrect.  You need parens around the filehandle.

    The elements of argument lists for formats are now evaluated in list
    context.  This means you can interpolate list values now.

    You can't do a goto into a block that is optimized away.  Darn.

    It is no longer syntactically legal to use whitespace as the name
    of a variable.

    Some error messages will be different.

    The caller function now returns a false value in a scalar context if there
    is no caller.  This lets library files determine if they're being required.

    m//g now attaches its state to the searched string rather than the
    regular expression.

    "reverse" is no longer allowed as the name of a sort subroutine.

    taintperl is no longer a separate executable.  There is now a -T
    switch to turn on tainting when it isn't turned on automatically.

    Symbols starting with _ are no longer forced into package main, except
    for $_ itself (and @_, etc.).

    Double-quoted strings may no longer end with an unescaped $.