... # Comparing columns 3 and 5 my $cmp_col_1 = 3; my $cmp_col_2 = 5; foreach my $sheet (@{$excel -> {Worksheet}}) { ... foreach my $row ($sheet -> {MinRow} .. $sheet -> {MaxRow}) { # Here's where you'd compare # $sheet -> {Cells} [$row] [$cmp_col_1] # with # $sheet -> {Cells} [$row] [$cmp_col_2] } }