use strict; use warnings; use List::Util qw(first); my %data = ( date => ['', '2009-01-01', '2009-01-02', ''], correct => ['Article_text1', 'Article_text2'], ); my $correction = first { length($_) } @{$data{correct}}; my $date = first { length($_) } @{$data{date}};