Ah, that makes sense. Of course, the usual way to solve this problem is with an unprivileged user account, but if your brother uses Windows 9x/Me then that option is out, since it doesn't have such things.

(Windows XP, being based on NT, does have the ability to create unprivileged user accounts, and while it's possible for a malicious and knowledgeable person to shatter (ahem) the barriers and get localsystem privileges from an unprivileged account, that's not something that would happen by accident, so it would be a safe sandbox for your brother to use to avoid inadvertently screwing up his system. If he has Windows XP, you could set him up an unprivileged/limited account and let him use that account to play with the command prompt.)

The real value, though, of a project like the one you're doing is in what it will teach you. It's a good project from that standpoint, because it will lead you through a number of different types of common programming issues. In fact, I would say that a command interpreter is a *particularly* good beginner project, because it easily breaks down into parts, and no one part is terribly difficult, but the overall project is quite involved and has a lot of parts. Also, you'll be able to test each part as you complete it, which is good. It'll teach you to code in a modular fashion, too, as you find that you need to abstract out things like wildcard matching, which various commands use. Overall, it's a very good project.

I once wrote my own fake "DOS" interpreter in GWBASIC, which I used as part of a practical joke. I created a phony antivirus package called Fool Proof AV, which would pretend to scan your hard drive for viruses, print scary warning messages about what it had found, then pretend it was reformatting your hard drive. Then it presented a nice "Finished" screen saying that in order to protect you, Fool Proof had reformatted your drive and installed an older version of DOS (1.7 as I recall; there is no such version, of course) that was now in the public domain (again, this is bogus, but almost believable), and you should carefully install any software you wanted to use, making sure it was virus-free first. Then it dumped you into my fake "DOS prompt", where DIR would show about three files in the root directory, plus one DOS directory containing a dozen more files, and nothing else.

So then I took it to my friend Andy, who didn't have any virus protection (which on a college campus circa 1994 was slightly dangerous). "Hey, Andy, I got this shareware antivirus thing. It didn't find anything on my computer. Want to try it out?" Then I stood over his shoulder and watched him run it. Great fun. It was hard to keep an earnest, straight face when he said, "What does this mean, Fool Proof has reformatted?" (He knew very well what it _meant_, of course. But you could hear in his voice he was having a little trouble assimilating the information. I muttered something to the effect that it hadn't done that on my computer. Then about ten very long seconds later something clicked in his head: "Doh, okay, you got me."

Writing a command interpreter in Perl should be much easier than writing it in BASIC, incidentally.


;$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$;[-1]->();print

In reply to Re: My First Perl Project by jonadab
in thread My First Perl Project by CloneArmyCommander

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.