Re: Elegant quoted word parsing

2004-06-25 Thread Beau E. Cox
On Sunday 13 June 2004 02:39 am, Jeff 'japhy' Pinyan wrote: > On Jun 10, Beau E. Cox said: > >sub parse_words > >{ > >my $line = shift; > >my @words = (); > > > >$_ = $line; [snipped] Thank you, japhy, and others who took the time to help me fix my word parsing script I posted several

Re: Elegant quoted word parsing

2004-06-13 Thread Jeff 'japhy' Pinyan
On Jun 10, Beau E. Cox said: >sub parse_words >{ >my $line = shift; >my @words = (); > >$_ = $line; You should localize $_ if you're going to be assigning to it explicitly. local $_ = $line; >while( 1 ) { >s/^\s*(.*?)\s*$/$1/; This is not a very efficient way to remov

Re: Elegant quoted word parsing

2004-06-12 Thread Zeus Odin
But this output is not at all similar to the output desired in the original post by Beau E. Cox. Your solution merely splits on all delimiters. -ZO "David Storrs" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Personally, I would do this: > > #!/usr/bin/perl > use Text::ParseWords

Re: Elegant quoted word parsing

2004-06-12 Thread David Storrs
On Fri, Jun 11, 2004 at 10:08:23AM -0500, James Edward Gray II wrote: > On Jun 10, 2004, at 9:46 PM, Beau E. Cox wrote: > > >Hi - > > > >I am trying to come up with a simple, elegant word parsing script, > >that: > > > >* takes a scalar string, and > >* splits it into words separating on white sp

Re: Elegant quoted word parsing

2004-06-11 Thread Zeus Odin
This is certainly shorter, but I doubt it fully adheres to your intent. It produces the same output as your procedure for this string, but it is possible that I changed some of the meaning of what you were trying to do: ---BEGIN CODE--- #!/usr/bin/perl use warnings; use strict; print joi

Re: Elegant quoted word parsing

2004-06-11 Thread James Edward Gray II
On Jun 10, 2004, at 9:46 PM, Beau E. Cox wrote: Hi - I am trying to come up with a simple, elegant word parsing script, that: * takes a scalar string, and * splits it into words separating on white space, commas, and a set of delimiters: "" '' // () {} [] ##, and * returns the array of words. [

Re: Elegant quoted word parsing

2004-06-10 Thread JupiterHost.Net
Beau E. Cox wrote: Does anyone want to help me find elegance? I think it looks pretty nice the way it is :) I do beleive you've found it Beau! ;p Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Elegant quoted word parsing

2004-06-10 Thread Beau E. Cox
Hi - I am trying to come up with a simple, elegant word parsing script, that: * takes a scalar string, and * splits it into words separating on white space, commas, and a set of delimiters: "" '' // () {} [] ##, and * returns the array of words. So far I have: # -