Please could monks point out problems with the following subroutine. I've tried to make the code self-explanatory.
sub Prioritise_requests { my $input_directory = @_; my $input_directory_lowest = $input_directory."1"; my $input_directory_highest = $input_directory."2"; opendir (LOWEST, "<$input_directory_lowest"); #opendir fix opendir (HIGHEST, "<$input_directory_highest"); #open dir fix (previ +ously just open)... see messages below for details my @lowest_priority = <LOWEST>; my $request_of_interest = 'none'; foreach (@lowest_priority){ # foreach low priority request my @highest_priority = <HIGHEST>; # fill high_priority array if (@highest_priority) { # If there are elements in the array #Do nothing } else { $request_of_interest = $_; } if (@highest_priority) { foreach (@highest_priority){ # foreach high priority request $request_of_interest = $_; return $request_of_interest; } return $request_of_interest; } } }
Update: Will the $request_of_interest contain the directory location as well as the file name. (that is what I want it to do).

In reply to Question mark regarding: my @lowest_priority = <LOWEST>; by Win

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.