The problem is that you’re calling glob in scalar context, but expecting it to behave as if called in list context. See I/O Operators:

A (file)glob evaluates its (embedded) argument only when it is starting a new list. All values must be read before it will start over. In list context, this isn't important because you automatically get them all anyway. However, in scalar context the operator returns the next value each time it's called, or undef when the list has run out. ... So if you're expecting a single value from a glob, it is much better to say

($file) = <blurch*>;

than

$file = <blurch*>;

because the latter will alternate between returning a filename and returning false.

Update: I don’t have a Solaris box, but on Windows I created two directories: ...\666_SoPW\home\vize\units\11780540\moving_code_AFT and ...\666_SoPW\home\vize\units\91540670\moving_code_INT and ran the OP code, with the following result:

12:25 >perl 666_SoPW.pl 11780540 good Use of uninitialized value $moving_code_dir in split at 666_SoPW.pl li +ne 41. 91540670 bad 12:25 >

I then changed the line:

my $moving_code_dir = glob("$UNIT_DIR/$unit/moving_code_*");

to

my ($moving_code_dir) = glob("$UNIT_DIR/$unit/moving_code_*");

as per the documentation quoted above, and the output is:

12:25 >perl 666_SoPW.pl 11780540 good 91540670 good 12:26 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: Coming across an issue with glob. Is only able to find every other directory. by Athanasius
in thread Coming across an issue with glob. Is only able to find every other directory. by walkingthecow

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.