Thread Variable in Array schreiben (9 answers)
Opened by Lumpi at 2009-05-11 19:48

topeg
 2009-05-11 19:58
#121494 #121494
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

use strict;
use warnings;

my @array = qw{jacke jeans shirt (kleidung) maus katze hund (tier) (kleidung) (tier)};

my @kleidung = ("jacke");
my @tiere=("Elephant");

for my $element (@array)
{
  $element=~s/\(kleidung\)/$kleidung[0]/;
  $element=~s/\(tier\)/$tiere[0]/;
}

print "@array\n";


"my" ergänzt, danke GwenDragon.
Last edited: 2009-05-11 20:02:33 +0200 (CEST)

View full thread Variable in Array schreiben