[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Stupid, non-Mac based PERL question



Andy Armstrong said:
: 
: while (<>) { push(@user, split(/\t/, $_)[1]); }

...which gives
  Can't use subscript on split

You gotta first make an array before you can take an element of it (and
may as well make it a bit more efficient as well):
  while (<>) { push(@user, ( split(/\t/, $_, 3) )[1] ); }

dan

-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch