Monksters,

I'm running into some problems moving around within the contents of some records that are getting sorted by a Schwartzian Transform. All of the contents of @records (below) are about a dozen lines long. Somewhere between the 10th and 12th lines there will be an "area = decimal.number" pattern. All I want to do is grab that decimal number without explicity referencing a line number. How do I do that?

In the example below, I am specifying the 10th line must be split by the pattern "area = ", and then the number in the 1 address is saved for sorting. How do I capture the number after "area = " without relying on a line number?

Many thanks in advance!

Regards,
-fiddler42
use strict; my @sortrecs = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, (split /area\s+=\s+/,$_->[9])[1] ] } @records;

In reply to Moving around in a Schwartzian Transform in strict mode? by fiddler42

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.