Thread Frage zu map
(7 answers)
Opened by mikdoe at 2009-07-17 17:16 Code (perl): (dl
)
1 2 3 4 5 my @array; $array[0] = 'A'; $array[1] = 'B'; $array[2] = 'C'; print "Liste:\n" . (join("\n",map{defined($_) ? "Wert => $_" : ''} @array)) . "\n" Was du mit Code (perl): (dl
)
1 2 3 print "Liste:\n" . (join "\n", map { defined ($array[$_]) ? "Wert $_ => $array[$_]" : '' } 0 .. $#array) . "\n"; |