my $i=0; for( $i=0; $i<=$n; $i++ ) { $list[$i] = &foo(1, 2, 3, 4, 5); if( $#list > &max_length ) { last; } my $result = &bar("$n", @list); if( $result > 999.999 ) { print STDERR "System halt"; exit; } } #### for( 0 .. $n ) { push @list, foo(1 .. 5); last if @list >= max_length(); warn('System halt') and exit if bar($n => @list) > 999.999; }