Help for this page

Select Code to Download


  1. or download this
    my @source = (1,2,3,4);
    my @dest = map { $_ * 2 } @source;
    ...
    #Output:
    #1 2 3 4
    #2 4 6 8
    
  2. or download this
    my @source = ('bob', 'joe');
    my @dest = map { $_ eq 'bob' ? ucfirst($_) : $_ } @source;
    ...
    #Output:
    #bob joe
    #Bob joe