if ( do{ local$"=''; @array1 == @array2 and "@array1" eq "@array2"} ) { print 'They are the same', $/; }