while(shift @text) { # do whatever... } unshift(@text,'') if @text;