my $var=1; while ($var == 1){ # do a bunch of stuff and never touch $var # exit if (some condition); }