in reply to Re: for mistake with shift
in thread for mistake with shift

Yes! I like that version, it does exactly what I want without the overhead of the duplicate array. I wonder if while (shift(@text)) { wouldn't work as well? Thanks!

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Replies are listed 'Best First'.
Re: Re: Re: for mistake with shift
by hsmyers (Canon) on Dec 31, 2003 at 15:25 UTC

    To answer my own less than bright question, Yes, but then the unshift would have to be outside of the loop. Something like:

    while(shift @text) { # do whatever... } unshift(@text,'') if @text;
    I Think I like the while (defined (shift @text)) { better.

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."