Help for this page

Select Code to Download


  1. or download this
    my @elems = qw(a b c d e);
    
    ...
    for my $elem (@elems) {
        print "last elem = $elem\n" if !$n--;
    }
    
  2. or download this
    my $n;
    for my $elem (map {$n++; $_} qw(a b c d e)) {
        print "last elem = $elem\n" if !--$n;
    }