"Advanced" functions

    If you're in a subroutine or block, you can use wantarray to determine which is wanted.

    An example of where context affects return values is in dealing with regular expressions:

    1. my $str = 'Perl 101 Perl Context Demo';
    2. my @ret = $str =~ /Perl/g; # @ret = ('Perl','Perl');

    .. and …

    In the previous example, was filled by hand. But these are equivalent:

    Oddly enough, it works with characters, too. If you want to get a list of letters from to , you can do:

    1. my @array = 'a'..'z';

    The range operators only increment. This will produce a zero-size list:

    If you want the reverse, ask for it.

    1. my @array = reverse 1..10; # @array descends from 10 to 1

    Submit a PR to