On Jul 24, Peter Fleck said:

>for $arrayref (@datedbi) {
>    #do stuff
>}
>
>It didn't look right and sure enough, it should be 'foreach'.
>
>But it worked fine and that's my question - why is this working?

In Perl, 'for' and 'foreach' are the EXACT SAME THING.

  for $x (@list) ...
  foreach $x (@list) ...

  for ($x = 0; $x < 10; $x++) ...
  foreach ($x = 0; $x <= 10; $x++) ...

Each pair is identical.  I never use "foreach"... it's four extra
characters, and I think "for" works in both instances just fine.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to