I see now! Worked like a charm. While we're on the topic of deletion/exclusion of string elements when brought in to an array, how do I kill '\n' line breaks from the string (or even just exclude them at array input time)?
ie. 'hello how are you /n I am fine' becomes (hello,how,are,you,I,am,fine) when in the array. Thanks Kevin, you're a champ. > From: [EMAIL PROTECTED] (Kevin Meltzer) > Reply-To: [EMAIL PROTECTED] > Newsgroups: perl.beginners.cgi > Date: Tue, 2 Oct 2001 20:09:50 -0400 > To: Shannon Murdoch <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Subject: Re: Killing multiple ' ' spaces from a string/$variable > > Hi Shannon, > > Very close. You are allowed to use a pattern in a split. > > my @codes = split(/\s+/,$all_codes); > > Should give you what you want. This will split the string on 1 or more spaces. > Look at 'perldoc -f split' for more information. > > Cheers, > Kevin > > On Wed, Oct 03, 2001 at 09:47:11AM +1000, Shannon Murdoch > ([EMAIL PROTECTED]) said something similar to: >> Hi all, >> >> I'm trying to get this string (example): >> >> $all_codes = '4c1 4- 4c2 4- 8b1 8g1'; >> >> in to an array (@codes), using it's whitespace as the delimiter. >> >> ie. @codes = split(/ /,$all_codes); >> > > -- > [Writing CGI Applications with Perl - http://perlcgi-book.com] > Deserve it (death)! I daresay he does. Many that live deserve death. And some > t > hat die deserve life. Can you give it to them? Then do not be too eager to > deal > out death in judgement. For even the wise cannot see all end. > -- Gandalf (Fellowship of the Ring) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]