I can see a few things that seem odd:

# use strict;

Why would you want to not turn strict mode on? Are you not interested in what parts of your code are peculiar enough that the compiler has code to look for them?

Next, if you check your script with "perl -c scriptname.pl" you will see a warning

"my" variable @a masks earlier declaration in same scope

The second push declares a second array @folder_name which hides the first array of that name; that makes $temp2 undefined later.

Once that is fixed, if you read the definitions of the push and pop functions carefully, you will notice that $temp1 gets the contents of the last line in file TWO if file TWO is not empty, otherwise it gets the last line in file ONE. $temp2 gets the contents of the next to last line in file TWO if there if there are two lines in file TWO, the last line in file ONE if there is one line in file TWO, and the next to last line in file ONE if file TWO is empty. Somehow I doubt that is what you had intended.

If you wanted a single line in $temp1 from file ONE, and wanted a single line in $temp2 from file TWO, you could remove the unnecessary array @folder_name and just:

my(@folder_name,$temp1,$temp2); ... $temp1 = <ONE>; ... $temp2 = <TWO>;
You should also check the value returned from mkdir, since it may indicate an error. The easiest way is with the "... or die" idiom:
mkdir "/var/www/html/piRNA_html/UNAFold/output/$temp2",0777 or die "Cannot make directory /var/www/html/piRNA_html/UNAFold/outpu +t/$temp2, error was $!";

In reply to Re: Problem in creating Directory by quester
in thread problem in mkdir by MVRS

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.