#!/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;