Thread map und array (6 answers)
Opened by bianca at 2010-07-05 19:04

bianca
 2010-07-05 19:04
#139498 #139498
User since
2009-09-13
7016 Artikel
BenutzerIn

user image
Ganz kurze Frage. Ich hab noch nicht so ganz verstanden, wie ich mittels map() erreiche, dass nicht definierte Einträge eines Arrays übersprungen werden:

Code (perl): (dl )
1
2
3
4
5
6
7
#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;

my @inhalt = (10,20,undef,40);
print "Und:\n" . join ("\n",map {$_ if defined $_} @inhalt) . "\n";


Ergibt:
Code: (dl )
1
2
3
4
5
Und:
10
20

40


Was ich aber gern hätte:
Code: (dl )
1
2
3
10
20
40


Wie muss ich das richtig schreiben?
Danke
10 print "Hallo"
20 goto 10

View full thread map und array