Hello,

You can do it in one line like:

<perl>

my $str = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"';

%hash = $str =~ /DimView\s+(\d+)\s+("[^"]*")\s+/g;

print "$_ $hash{$_}\n" for keys %hash;

</perl>

Aziz,,,


On Thu, 28 Jun 2001 16:32:28 -0400, Seitz, Scott said:

> 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?
>  
>  Thanks,
>  
>  Scott
>  


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to