Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hey Guys

Another glorious day in scripting heaven, when all of a sudden a wild request appears. I need to create a script that checks two files together that have the same name but a different extension. i.e. (*.in) and (*.out)

So far I have managed to get the information I need from the *.in file but I have no idea how to check it against the information in the .out file.

Also I need to check that the file names(without the extension match)

This is my code so far:
use strict; my @files = <*.in>; for my $file (@files) { open my $read, '<', $file; open my $write, '>', "$file.log"; my $scid; my @lines; while(<$read>) { @lines = split('', $_); if($. == 3) { $scid = substr $_, 72,6; print $write "$scid\n"; } } #check where files match close($read); }
At the moment it only prints the unique identifier from the *.in the file to a seperate file to check that this is correct. The identifier is A00000 (one alpha 5 numeric) and is the 72nd bit offset from the 4th line, in the *.in file. However is 2nd line in and the 28th bit across in the *.out file. Please help!

In reply to Find a file with same name but different extension by Jalcock501

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (4)
    As of 2018-04-26 06:42 GMT
    Find Nodes?
      Voting Booth?