--- "Seitz, Scott" <[EMAIL PROTECTED]> wrote:
> I'm having trouble with what I think is a very simple split question.
> 
> I've got a line of text something like:
> 
> DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"
> 
> I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "None")
> 
> I'm spitting on /DimView/, but I can't get the syntax to throw it
> into the hash correct.  Can one of you thow me a couple of lines of
> code to get me through this?

Try this:

  my $str = 
  'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"';
  my @pairs = split /\s*Dimview\s*/, $str;
  my %hash;
  for (@pairs) {
     my ($key,$val) = split /\s/;
     $hash{$key} = $val;
  }

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to