Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I can see a few things that seem odd:

my(@folder_name,$temp1,$temp2); ... @folder_name=<ONE>; ... push(my @folder_name,<TWO>); ... $temp1 = pop(@folder_name); $temp2 = pop(@folder_name);

If you check your web server logs, or 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. In the simple case where both files are one line long, $temp1 gets the file TWO contents and $temp2 get file ONE's. 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 mkdir 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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-16 18:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found