When it comes to the questions, you aren't calling your sub routines, so how could they? Adding
&dir; &name; &ext;
before you are trying to use the variables will at least ask the questions... but before anything else, you need to turn on strict and use -w. Please.

Then, decide which method you want to use. Either the combination opendir/readdir or glob. They don't have anything to do with each other (so scratch the opendir for now, and read up on glob, if that is your chosen way). That is one of the reasons it will not return any files from directory $dir.

I furthermore ask why you are doing:

$ext = <STDIN> ; $e = $ext ;
when
$e = <STDIN> ;
does the job? In reality, I see no use for such a small program to use subroutines at all, or at least use one, slightly bigger instead for this. I'd also consider returning values from them, if you have them, instead of setting global variables.

Hmm... that was a lot of complaining. :( Sorry about that, but well, you would have a lot easier time if you listened to some of it at least. :)


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

In reply to Re: Newbie in need... by Dog and Pony
in thread MS-DOS search using globs by Mr_Cassata

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.