Re: Squeezing a list

2002-01-03 Thread Michael R. Wolf
Joshua Colson <[EMAIL PROTECTED]> writes: > @NEWLIST = grep(!/^$/, @LIST); Is there a reason you're using UPPER CASE? It's not *wrong*, it's just more perl-ish style to use lower case. @newlist = grep(!/^$/, @list); And it lets your Shift key last longer :-) -- Michael R. Wolf All

Re: Squeezing a list...

2002-01-03 Thread Matthew Lyon
Yes, I know what grep does... sorry. I was missing some of the programming compactness stuff... On Thu, 3 Jan 2002, Jeff 'japhy' Pinyan wrote: > On Jan 3, Matthew Lyon said: > > >On Thu, 3 Jan 2002, Jeff 'japhy' Pinyan wrote: > > > >> I'd use grep(): > >> > >> @compressed = grep length, @ar

Re: Squeezing a list

2002-01-03 Thread Jeff 'japhy' Pinyan
On Jan 3, Matthew Lyon said: >On Thu, 3 Jan 2002, Jeff 'japhy' Pinyan wrote: > >> I'd use grep(): >> >> @compressed = grep length, @array; >> >> That only allows elements with a non-zero length to get through. > >wait! how does this grep trickery work? where's the circuitry? Uh... it's what

Re: Squeezing a list

2002-01-03 Thread Matthew Lyon
wait! how does this grep trickery work? where's the circuitry? On Thu, 3 Jan 2002, Jeff 'japhy' Pinyan wrote: > On Jan 3, Busse, Rich said: > > >("Abiosdsk", "Afd", "", "", "", "Aha154x", "Aha174x", "aic78xx", "", > >"Alerter", "", "", "", "Always", ...) > > > >Is there a simple way to get rid

Re: Squeezing a list

2002-01-03 Thread Jeff 'japhy' Pinyan
On Jan 3, Busse, Rich said: >("Abiosdsk", "Afd", "", "", "", "Aha154x", "Aha174x", "aic78xx", "", >"Alerter", "", "", "", "Always", ...) > >Is there a simple way to get rid of the empty strings and compress the list >down to: > >("Abiosdsk", "Afd", "Aha154x", "Aha174x", "aic78xx", "Alerter", "Alw

RE: Squeezing a list

2002-01-03 Thread Joshua Colson
For the sake of argument we'll assume that you've assigned your list to an array named @LIST. Try this. @NEWLIST = grep(!/^$/, @LIST); # Grep the list for any element that is not empty. Now @NEWLIST should only contain those entries that have some content to them. Hope this helps. -Origina