Help for this page

Select Code to Download


  1. or download this
    a = [ 'a','b','c','d','e','f','g' ]
    a[:3]    # abc
    a[:-3]  # abcd
    a[3:]   # defg
    a[-3:]  # efg
    
  2. or download this
    my @a = qw/a b c d e f g/;
    
    ...
    say join( '', tail( -3, @a)) . " should be defg"; # except when -0!
    # python a[-3:] = 'efg' (ie. select last 3)
    say join( '', tail( 3, @a)) . " should be efg";