in reply to Breaking out of a while loop: Is there a better way?

Are you maybe forgetting (needing to learn) about "last" ?
# get drive while (<PLAY>) { ++$counter; print "$counter\n"; if (/src=\"(.)\:\\/) { $original_drive_letter = $1; last; # exit the while loop now } } close PLAY;