#!/usr/bin/perl use warnings; use strict; sub calcdiff { my $old = shift; my $new = shift; if ($new > $old) { my $ergebniss_1 = ($new - $old); return($ergebniss_1); } elsif ($old > $new) { my $ergebniss_2 = ($old - $new); return ($ergebniss_2); } } open(INFILE, "test.txt"); my @content = ; foreach (@content) { if (my $path = $_ =~ m/^(.+):\s+(\/.+):$/) { chomp($path); print("$1\n"); } elsif (my $size = $_ =~ m/(^\d+)\s+(.+)\s+(.)\s+(\d+)\s+(.+)\s+$/) { chomp($size); if ($3 eq "\|") { print "\t$2\t$1\t$4\t" . "Diff: " . &calcdiff("$1","$4") . "\n"; } elsif ($3 eq "\<") { print("\tNew File:\t$5\tSize: $4\n"); } elsif ($3 eq "\>") { print("\tFile deleted:\t$5\n"); } } }