#!/usr/bin/perl use strict; use warnings; my $file = '/path/to/file.txt'; my %hash; open my $fh,'<',$file or die $!; while(my $line = <$fh>){ next unless $line =~ /^Modul:/; chomp $line; my ($modul,$size) = (split /\s+/,$line)[1,3]; $hash{$modul} = $size; } close $fh; print sprintf("%10s -- %10s",'Modul','Größe'); for my $module(sort{$a cmp $b}keys %hash){ print sprintf("%10s -- %10s",$key,$hash{$key}); }