#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %set; my @limits = ( "Schrauben;Error;200;500", "Schrauben;Process;25;50", "Schrauben;Waiting;100;150", "Muttern;Error;10;30", "Muffen;Waiting;400;800", "Muffen;Process;5;10", ); while (my $row = pop @limits) { my @cols = split /;/, $row; $set{$cols[0]}->{$cols[1]}->{'min'} = $cols[2]; $set{$cols[0]}->{$cols[1]}->{'max'} = $cols[3]; } warn Dumper \%set; while () { chomp; my @row = split; $row[3] = 'green' if $row[2] < $set{$row[0]}->{$row[1]}->{'min'}; $row[3] = 'yellow' if $row[2] >= $set{$row[0]}->{$row[1]}->{'min'} and $row[2] < $set{$row[0]}->{$row[1]}->{'max'}; $row[3] = 'red' if $row[2] > $set{$row[0]}->{$row[1]}->{'max'}; print join ' ', @row; print "\n"; } __DATA__ Schrauben Error 234 Schrauben Process 12 Schrauben Waiting 151 Muttern Error 45 Muffen Waiting 156 Muffen Process 23