Hey fellas.
I'm using
IO::Dir in a script. That script should simply show the files in a defined dir or if there aren't any, show a message telling the user.
So, I did it this way:
$file_folder = "foo/foo2/";
tie %arquivos, IO::Dir, $file folder;
if (scalar ( keys %arquivos) ne 0)
{
foreach (keys %arquivos)
{
if ($_ ne "." and $_ ne "..")
{
<a href=\"$file_folder$_\">$_</a>\n";
}
}
}
else
{
print "There are no files\n";
}
Well, how can this same code works in one kind of situation and don't work on other kind?
When it works, it displays the "No files" message, but when it doesn't it just doesn't print anything.
I would specify the situations here, but it is the
same script, with the
same empty directory, so why this is happenning?
I found out that when it doesn't works is because of the
. and the
.. "entries" in NT, but then again it should never work, because NT always create this two "entries", right? And it's looking on the same dir anyways, so it just doesn't make any sense.
Please help me here, fellas, because I just can't see any logic reason for this behaviour.
Er Galvão Abbott
a.k.a. Lobo, DaWolf
Webdeveloper
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.