Don't get too worried over the less obvious bits of the file handling stuff. Perl lets you use a variable as a file by using a reference to it in the open:

my $stringBeingAFile = "This is the contents of the stringy file\n"; open my $inFile, '<', \$stringBeingAFile;

which I use in the sample script to avoid having to create temporary files for demonstration purposes. In the current case it's slightly more complicated because you want to deal with multiple files so I use a hash that is pretending to be a directory of files (really a hash of file name => file content pairs).

But, as I suggested, you needn't worry about that so long as you can see past the first 36 lines and ignore the "use a string as a file" syntax in the opens the remainder of the code is the important bit.


True laziness is hard work

In reply to Re^3: Extracting coordinates by GrandFather
in thread Extracting coordinates by Ignas

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.