Help for this page

Select Code to Download


  1. or download this
    my @a = (1,2,3,4,5);
    (undef, my @b) = (@a);
    print "@b\n";
    #prints: 2 3 4 5 (the 1 is gone)
    
  2. or download this
    my @a = (1,2,3,4,5);
    my @b = @a[0,2..4];
    print "@b\n";
    #prints: 1 3 4 5
    
  3. or download this
    my $text = "1 2 3 4 5 6";
    my @tokens = split(/\s+/,$text,2);
    ...
    #prints:
    1
    2 3 4 5 6