-1

Apologies for being newbie, I inherited perl code that I can not figure out, perhaps one of you can.

for ( @{$things} ){

...
}

I know arrays begin with @ and scalars begin with $.

I am not sure exactly what we are doing here, and attempts to print it out fail. What is the best way to print out @{$things} so I can figure out what this for loop is all about?

MuchNoob
  • 3
  • 2

1 Answers1

1

$things is a reference to an array
@{$things} dereference this array

See this doc.

Toto
  • 89,455
  • 62
  • 89
  • 125
  • Brilliant, thanks a lot. Now I understand more how to loop over an array with only a reference. Kudos. – MuchNoob Mar 28 '14 at 10:52