#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $collection_times='Mo-Fr 15:00,18:00,19:00,23:00; Sa 15:00; Su 10:30,23:00'; my @collection_list; for my $collection (split(/;\s*/,$collection_times)) { my ($day,$time)=split(/\s+/,$collection,2); # ist es wirklich ein Wochentag? (mo tu we th fr sa su) if($day=~/^[motuwehsa-]+$/i) { my @time=split(/\s*,\s*/,$time); push(@collection_list,{day=>$day, time=\@time}); } } print Dumper(\@collection_list);