Re: extracting values from split without using an array

2008-03-10 Thread Chas. Owens
On Mon, Mar 10, 2008 at 1:49 AM, Rodrick Brown <[EMAIL PROTECTED]> wrote: snip > For example if you we're only interested in fields 1,3, and 5 you > could do something like > ($field1,undef,$field3,undef,$field5) = split/.../; > > Or you can do something like (split//...)[3] snip You can also

Re: extracting values from split without using an array

2008-03-09 Thread J. Peng
On Mon, Mar 10, 2008 at 1:37 PM, igotux igotux <[EMAIL PROTECTED]> wrote: >I tried > split(/\s+/,$var)[1] which is not working as i expected. You may be moving from python,:) In perl you should say, (split /\s+/,$var)[1]; because split /\s+/$var returns a list, use () to enclose the list's sco

Re: extracting values from split without using an array

2008-03-09 Thread Rodrick Brown
On Mon, Mar 10, 2008 at 1:37 AM, igotux igotux <[EMAIL PROTECTED]> wrote: > Hi, > I want to extract values from split without defining an array. Say i want to > access second element in the split output :- split (/\s+/,$var) . I tried > split(/\s+/,$var)[1] which is not working as i expected. C

extracting values from split without using an array

2008-03-09 Thread igotux igotux
Hi, I want to extract values from split without defining an array. Say i want to access second element in the split output :- split (/\s+/,$var) . I tried split(/\s+/,$var)[1] which is not working as i expected. Can someone please correct me on this ? Thanks, IGotux