Help for this page

Select Code to Download


  1. or download this
    @a = map {
        # A function of $_, eg:
        $_ . ".txt"
    } @a;
    
  2. or download this
    # Emulate grep with map
    @a = map { elementShouldBeIncluded($_) ? $_ : () } @a;
    
    # Double up the list
    @a = map { ($_, $_) } @a;
    
  3. or download this
    @a = map {
        # Is it a dir?
    ...
            # It's a file - pass it straight through
            $_
    } @a;