Map to an array : map « Array « Perl






Map to an array

   

@a = (1 .. 10);

map {$_ *= 2} (@a);

print join(", ", @a);

2, 4, 6, 8, 10, 12, 14, 16, 18, 20

   
    
    
  








Related examples in the same category