Sorry If I have bothered you with RegEx posts, But it seems I have a mental block for them at the moment!

I have this data
version 2.0(3) vsan database vsan 1000 name "SANMGMT_Green" vsan 1010 name "IMIS_Green" vsan 1030 name "TEMS_Green" vsan 1050 name "IPBilling_Green" vsan 1060 name "Greek_Green" vsan 1900 name "SRDF_Green" vsan 3120 name "TAPEA_GREEN" power redundancy-mode combined force logging server 10.33.34.235 6 fcdomain domain 20 static vsan 1 fcdomain fcid persistent vsan 1 fcdomain domain 20 static vsan 1000 fcdomain fcid persistent vsan 1000 fcdomain domain 20 static vsan 1010 fcdomain fcid persistent vsan 1010 fcdomain domain 20 static vsan 1030 fcdomain fcid persistent vsan 1030 fcdomain domain 20 static vsan 1050 fcdomain fcid persistent vsan 1050 fcdomain domain 20 static vsan 1060 fcdomain fcid persistent vsan 1060 fcdomain domain 20 static vsan 1900 fcdomain fcid persistent vsan 1900 fcdomain fcid persistent vsan 3120 fcdomain fcid database vsan 1060 wwn 50:06:04:84:4a:36:f4:d8 fcid 0x6d0000 dynamic vsan 1060 wwn 50:06:04:84:4a:36:f4:d6 fcid 0x6d0001 dynamic vsan 1050 wwn 50:06:04:84:4a:36:f4:d7 fcid 0x140001 dynamic vsan 1060 wwn 50:06:04:8c:4a:36:f4:c2 fcid 0x6d0002 dynamic
and I want to grab the following data from the above
vsan 1000 = "SANMGMT_Green" vsan 1010 = "IMIS_Green" vsan 1030 = "TEMS_Green" vsan 1050 = "IPBilling_Green" vsan 1060 = "Greek_Green" vsan 1900 = "SRDF_Green" vsan 3120 = "TAPEA_GREEN"
So I put together this bit of code
local $/ = ""; while ( my $record = <DATA> ) { my ($vsan) = $record =~ /^\s+vsan\s(\d+)/; my ($vname) = $record =~ /^\s+vsan\s\d+name\s(.+)$/; print "$vsan, $vname\n"; }
What I mean here is;
with $vsan : from the beginning, there is at least one white space, followed by the word vsan, then another space, then few digits which I want Perl to grab.

with $vname : from the beginning, there is at least one white space, followed by the word vsan, then another space, then few digits, followed by the word ‘name’, then another white space, then grab everything till the end of that line

Well this makes perfect sence to me however I do not get any output!

Can I ask if someone can show how is this done?

Thanks

################### UPDATE ######################

I'll prove myself wrong

got rid of local $/

And used this code
next unless ($record =~ /^\s+vsan\s(\d+)\sname\s(.+)$/); print $record;
Blackadder

In reply to Prove me wrong,...please (yet more regex blues). by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.