in reply to 30 Spaces- 1 question

How about this?
@first_thirty[0..29] = split " ", $string;
or, if you want the first 30 words as a single try you can:
$first_thirty = join " ", (split " ", $string)[0..29];
...which doesn't avoid the split/join thing, but by specifying an array slice you might avoid the memory hit of splitting the entire string when all you want is the first 30 words.

Gary Blackburn
Trained Killer

Replies are listed 'Best First'.
RE: Re: 30 Spaces- 1 question
by extremely (Priest) on Oct 09, 2000 at 09:58 UTC

    split has a form for avoiding overspliting, you can give it a count of how many parts you want, see my first post.

    @array = split / /, $string, 31;

    OTOH, your array slice will fix my dropping the last item with pop foolishness...

    --
    $you = new YOU;
    honk() if $you->love(perl)