The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Syntax for List Ranges

List ranges are used in the list and disassemble commands.

A list range is in one of the following forms:

    location       # starting line only
    first, last    # starting and ending line
    , last         # ending line only

A location is described elsewhere. first can also be a location but they aflso may be a number. And finally last can be an offset.

A number is just a decimal number. An offset is a number prefaced with "+" and indicates the number to increment the line number found in *first*.

Examples

    5                           # start from line 5 of current file
    5 ,                         # Same as above.
    5                           # listsize lines before and up to 5
    foo.pl:5                    # start from line 5 of file foo.py
    foo()                       # start from function foo
    File::Basename:5            # start from line 5 of module File::Basename
    File::Basename:5            # Same as above.
    File::Basename:5, 6         # list lines 5 and 6 of File::Basename
    File::Basename:5, +1        # Same as above. +1 is an offset
    File::Basename:5, 1         # Same as above, since 1 < 5.
    File::Basename:5, +6        # lines 5-11
    File::Basename.join()       # lines starting with the os.join.path function.
    "c:\foo.pl":10,             # listsize lines starting from line 10 of c:\foo.py