#! user/bin/perl use warnings; use strict; my @x = ( [1,1], [2,2], [3,3] ); my @y; sub do_something {} # this is what I want, but--- gets "syntax error ... near "$y[" # foreach $y[0] (@x) { <=== syntax error on this line # foreach $y[1] (@x) { # do_something(@y); # } # } # so, I use this method instead foreach (@x) { $y[0] = $_; foreach (@x) { $y[1] = $_; do_something(@y); } }