Thread regulärer ausdruck (18 answers)
Opened by Gast at 2004-07-13 17:39

Gast Gast
 2004-07-13 19:02
#84214 #84214
So gehts denn auch ...
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl

   use strict;
   use warnings;
   
   my @cont = (
       'cd.interpret.album.song',
       'cd.interpret.album',
       'cd.interpret'
   );
   
   my (@song, @album, @interpret);

       foreach (@cont) {
           my @temp = split /\./, $_;
           $#temp == 3 && (push @song, $_);
           $#temp == 2 && (push @album, $_);
           $#temp == 1 && (push @interpret, $_);
       }

   print "Song: $_\n" foreach @song;
   print "Album: $_\n" foreach @album;
   print "Interpret: $_\n" foreach @interpret;

View full thread regulärer ausdruck