Perl

my @arr = ( 1, 2, 3 );
while( @arr ){
  print $_, "\n";
}

出力結果

1
2
3

または

my @arr = ( 1, 2, 3 );
while my $arr ( @arr ){
  print $arr, "\n";
}

出力結果

1
2
3

PHP

$arrNum = array( 1, 2, 3 );
while( $arrNum as $num ){
  echo $num. "\n";
}

1
2
3