Thread RegEx (3 answers)
Opened by LordChaos at 2005-06-29 16:21

dominicn
 2005-06-29 18:27
#55824 #55824
User since
2003-08-08
327 Artikel
BenutzerIn
[default_avatar]
Ich würde es wahrscheinlich nicht mit RegEx lösen sondern folgendermaßen:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
use Data::Dumper;
my $str = "EXPRESS     liver; colon; small intestine; other; mixed; bone";

my ($name, $werte) = split(/\s/, $str, 2);
my %zielhash = ();
my $count = 0;
foreach (split(/\;/, $werte)) {
   $_ =~ s/^\s+//g;
   $_ =~ s/\s+$//g;
   $zielhash{$name."_".++$count} = $_;
}

print Dumper(\%zielhash);

View full thread RegEx