In your closing request:

Without concatenating the data lines, or using a subhash on the hash, is there a way I can keep all that data keyed together?

Is there some reason why you need to avoid concatenating the data lines, or using a multi-level hash? Because I think either of those (actually both) would suit what I think you want... fever's point about joining the regexes seems like a very plausible place to start:

foreach $line(@urllist){ $data = get($line); if ( $data =~ m!$regex1\r?\n$regex2!io ) { $school->{school} = $1; ($school->{school}{addr}, $school->{school}{city}, $school->{school}{zip}, $school->{school}{phone}, $school->{school}{level}) = ($2,$3,$4,$5,$6); } # might the two lines show up in reverse order? then elsif ( $data =~ m!$regex2\r?\n$regex1!io ) { $school->{school} = $3; ($school->{school}{addr}, $school->{school}{city}, $school->{school}{zip}, $school->{school}{phone}, $school->{school}{level}) = ($4,$5,$6,$1,$2); } else { next } print join $/, $school->{school}, map{$school->{school}{$_}} qw/addr city zip phone level/; print $/; };
Did I draw the right conclusions about your data? Does this break some condition that you left out of your post? (update: fixed indentation)

In reply to Re: Question on anon hashes by graff
in thread Question on anon hashes by Popcorn Dave

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.