Re: How to prevent split from returning blanks

2007-10-28 Thread Chas. Owens
On 10/28/07, yitzle <[EMAIL PROTECTED]> wrote: snip > Arrays can be set from lists and arrays get converted to lists all the time. > Is there any practical difference? (Other than the fact that an array > has a reference which can be passed as a scalar?) snip There are several key differences and

Re: How to prevent split from returning blanks

2007-10-28 Thread John W . Krahn
On Sunday 28 October 2007 16:13, Jo for Groups and Lists wrote: > What I want are these array members from a string in a database. I'm > almost there, just need to strip off the trailing pipe, but I am > getting empty members too, so will have to test for that and dump the > empty ones before proce

Re: How to prevent split from returning blanks

2007-10-28 Thread Jeff Pang
That perldoc has said, a list is a value while an array is a variable. so [EMAIL PROTECTED] get what you wanted but \(1,2,3) returns each elements' reference. also @array = (1,2,3) will convert a list to an array automatically, and mysub(@array) will set an array as a list automatically. and you

Re: How to prevent split from returning blanks

2007-10-28 Thread yitzle
Oops. Duly noted. Functions/Subs return lists, not arrays. But then again, grep() takes a list, and not an array :) Arrays can be set from lists and arrays get converted to lists all the time. Is there any practical difference? (Other than the fact that an array has a reference which can be passe

Re: How to prevent split from returning blanks

2007-10-28 Thread Jeff Pang
On 10/29/07, yitzle <[EMAIL PROTECTED]> wrote: > split() returns an array. split returns a list not an array. perldoc -q 'What is the difference between a list and an array?' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: How to prevent split from returning blanks

2007-10-28 Thread yitzle
split() returns an array. You can use the grep() function to filter an array based on a RegEx, eg empty string (/^$/) @arr2 = grep !/$^/, @arr1; This will make @arr2 hold everything in @arr2 except empty elements. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM