edit: Okay, I'm an idiot. One of the filenames is hard-coded in the script. But we're still stumbling over the idea that there are two input files, and the script only opens one. So I'll leave the rest of this message intact, to show what an idiot I was in making up two new filenames instead of just the one which is actually missing.

Okay, so I've entered your data into two input files just like it says in the first message:

-----( Begin file1.txt )-----
BCA 

CA 

ACBAA 

-----( End file1.txt )-----
-----( Begin file2.txt )-----
1 2 3 

11 22 33 

-----( End file2.txt )-----

I don't know why you have the extra blank lines in the files, but you showed them that way in the original message, so that's how I've entered them.

Now I run your script:

C:\Steve\Projects\PerlMonks\AminoSplit>perl amino.pl file1.txt outfile.txt

C:\Steve\Projects\PerlMonks\AminoSplit>dir

 Volume in drive C is CBoot
 Volume Serial Number is B4AB-1A65

 Directory of C:\Steve\Projects\PerlMonks\AminoSplit

05/14/2011  02:12 PM    <DIR>          .
05/14/2011  02:12 PM    <DIR>          ..
05/14/2011  02:10 PM                 0 $Notes.txt
05/14/2011  02:08 PM               870 amino.pl
04/15/2010  11:16 AM               107 ci.cfg
05/14/2011  06:29 AM                39 doit.bat
05/14/2011  02:09 PM                25 file1.txt
05/14/2011  02:10 PM                23 file2.txt
05/14/2011  02:08 PM    <DIR>          new
05/14/2011  02:08 PM    <DIR>          old
05/14/2011  02:12 PM                 3 outfile.txt
               7 File(s)          1,067 bytes
               4 Dir(s)   3,317,903,360 bytes free

And I notice it's written outfile.txt just like we would expect. Its contents do not look anything like your original message suggested it would look like.

-----( Begin outfile.txt )-----
0
-----( End outfile.txt )-----

You claim this works for one line.

This does not look like what I would expect.

I say again, I do not see anywhere in your Perl script where you are attempting to read the input file. In fact, all you seem to be doing is reading the input filename and acting on its name.

I presume you'd actually like to process its contents. I can help you with that, but I need to know where in your script you are expecting to do so.


In reply to Re^8: string value assignment by marinersk
in thread string value assignment by abidq

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.