#!/usr/bin/perl use strict; use warnings; my $file = './data.txt'; my $content; { local $/; open my $fh,'<',$file or die $!; $content = <$fh>; close $fh; } my (@entries) = $content =~ /([^\n]*?\n\s*{.*?})/gs; my $created = ""; for my $entry(@entries){ my ($type,$info) = $entry =~ /([^\n]*?)\n\s*{(.*?})/s; my %hash; my @lines = split /\n/,$info; for my $line(@lines){ $line =~ s/^\s+//; my ($key,$value) = split /=/,$line,2; $hash{$key} = $value; } if($type = 'info'){ $created = $hash{created}; } else{ print "$created SERVICETYP weitere info\n"; } }