hi,

if we ignore the possibility that the following code could
ruin your day, it could be considered dark fun:

this one:

use strict;

for(1..3)
  {
  my $id = 1 if $_ == 3;
  print "[$id]\n";
  $id = 999;
  }

prints:

[]
[999]
[1]

why?!

`my $id' defines new var every time in the loop, so
expected output is:

[]
[]
[1]

the only explanation I see is that `my' is executed only once,
and $id most of the time is global (i.e. packaged) so `strict' is
fooled...

any ideas?

P! Vladi.
--
Vladi Belperchinov-Shabanski <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Personal home page at http://soul.datamax.bg/~cade
DataMax SA   http://www.datamax.bg
Welcome to this crazy world, welcome to the show that never ends...

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to