#!/usr/bin/perl use strict; use warnings; my $VAR1 = { 'table' => [ [ 'CredSMB.168', '168', '1', 'Customer.1', '', 'BNS-NA-CA-SMB-SCGLOBAL', '3', 'SCGLOBAL', 'ip360scglobal' ] ], 'columns' => [ 'REFERENCE', 'id', 'type', 'customer', 'notes', 'name', 'authAlgorithm', 'domain', 'userName' ] }; foreach my $i (0 .. $#{$VAR1->{columns}}) { if ($VAR1->{columns}[$i] =~ /^userName$/) { print "$VAR1->{table}[0][$i]\n"; } }