I don't think you want to use split.. at least I wouldn't. I would do:

<CODE>
my %foo = ();
my $line = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4
"None"';
$foo{$1} = $2 while $line =~ m/DimView (\d) "([^"]+)"/g;
</CODE>

That gives me %foo as (according to Data::Dumper):
        {
          1 => 'All',
          2 => 'Some',
          3 => 'Most',
          4 => 'None'
        };



> -----Original Message-----
> From: Seitz, Scott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 28, 2001 1:32 PM
> To: '[EMAIL PROTECTED]'
> Subject: Simple Split Question
>
>
> 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
>

---------------------
Stephen Nelson
"stephen" on PerlMonks (www.perlmonks.com)
[EMAIL PROTECTED]

Reply via email to