Wiggins d Anconia wrote:
my $k;
for($i = 0; $i < $c; $i++){
if ( defined $k ){
print $x[$k];
my $t; # intentionally undefined
$k = $t; # undefine $k
} else {
$k = $i;
} }




Unless this is a contrived example, just increment $i by 2 each loop. If it is contrived then the other answers should work...

Well, $c and @x were never defined/explained by the time this contruct was presented.

--
-Sx-

[This message contains no user serviceabe code.]

use strict;
use warnings;
use diagnostics;

my (@x) = qw% But for sanities sake %;
my ($c, $i, $k, $t) = 2**32+1;

undef $k;

for($i=0, $c=2; $i<$c; $i=0) {

  if ( defined $k ) {
      print $x[$k];
      $k = $t;
   } else {
      $k = $c;
   }
}

__END__

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to