in reply to implicit split to @_ is deprecated

If you are working with larger data 'lines' it might be interesting for you to use a combination of both methods:
my $start = split(/\s+/, $data[146], 4)[3];
This will avoid matching the delimiter more than three times and can save you some time when processing huge amounts of data in scalar variables. So it probably doesn't apply to your case. But maybe you'll find it entertaining, at least ;-)
Cheers,
CombatSquirrel.
Entropy is the tendency of everything going to hell.

Replies are listed 'Best First'.
Re: Re: implicit split to @_ is deprecated
by Anonymous Monk on Aug 29, 2003 at 19:07 UTC
    It is a good idea but it won't work the way you have it. The problem is that with limit parameter, the last element contains the rest of the string. If there are more than four data fields, then the fourth element will contain all of them. Also, the parenthesis around the split are needed to force it into list context. Instead, this will work:
    my $start = (split(/s\+/, $data[145], 5))[4];
      Errr, OK, OBO error ;-) Stupid 0-indexed arrays
      Thanks
      CombatSquirrel.
      Update: Your code won't work either. Use array index 3 instead of 4 - you are getting the rest field as well.
      Entropy is the tendency of everything going to hell.