Loading ...
Sorry, an error occurred while loading the content.

Starting Out

Expand Messages
  • viktor.shaw
    Hi, I am completely new to perl and have been trying to read tutorials I can find, doing the examples they contain, and trying to write a bit of code on my
    Message 1 of 6 , Feb 24, 2008
    • 0 Attachment
      Hi, I am completely new to perl and have been trying to read
      tutorials I can find, doing the examples they contain, and trying to
      write a bit of code on my own. I am running into some troubles
      though since I'm really more of a hands-on kind of person. I learn
      by doing and so have decided it would probably be in my best interest
      to just go ahead and try to write a small program on my own to get a
      better feel of things. Unfortunately this is where the problem is
      since as I said, I am a complete beginner. I'm basically wondering
      if anyone could give me a little bit of advice, maybe help out a
      little with the code, point me in the right direction, and just get
      me on my way (a bit like helping someone learn to ride a bicycle for
      the first time).

      The program I want to start out with should be easy enough and should
      show me a lot of the basics of writing future programs. What I want
      to do is as follows:

      I want my program to be used with a regular deck of 52 playing cards
      (I could include the Jokers as well defining them with a specific
      number too). Once executed I want my program to basically just
      say "Hi, please enter your first card, for example 2 Hearts or Ace
      Spades" Once you enter the card number and suit the program will
      decide how to react. I want the program to denote cards as follows:
      2-10 of course will be 2-10. Jacks will = 11, Queens = 12, Kings =
      13, Aces = 14, and if we do use the Jokers they could = 15. Also
      each suit has a meaning to the program too: Spades = Add, Hearts =
      Subtract, Clubs = Multiply, Diamonds = Divide. Once you start
      entering cards the program will know how to respond based on this.
      For example you execute the program and are asked to enter your first
      card, say King Hearts, which would make the program respond with a
      total of -13, then ask for your next card, which could possibly be 9
      Clubs, giving a new total of -4 and so on. Once you have gone
      through all 52 cards (or 54 if I decide to use the Jokers) I want the
      program to prompt you letting you know that you have gone through the
      entire deck and give you a grand total, then allow you to either 1)
      do it all over again, or 2) terminate the program.

      I would really appreciate any advice/help I can get on this as well
      as being pointed in the right direction of good/better tutorials than
      the ones I have been able to find so far. Also if anyone feels this
      is too complicated of a program for me to be dealing with right now
      please say so and maybe give some advice on what I SHOULD be doing,
      but I'm just honestly tired of doing examples where mainly all you do
      is: print 'This is three \\\'s: "\\\\\"' ,"\n"; One thing I don't
      want is for someone to do this for me, just help guide me along. I
      can't learn if I have someone do it for me :P

      Thanks for any help and advice I receive.


      Viktor Shaw
      NSA-CSS
      viktor.shaw@...
    • merlyn@stonehenge.com
      ... viktor The program I want to start out with should be easy enough and should viktor show me a lot of the basics of writing future programs. What I want
      Message 2 of 6 , Feb 24, 2008
      • 0 Attachment
        >>>>> "viktor" == viktor shaw <viktor.shaw@...> writes:

        viktor> The program I want to start out with should be easy enough and should
        viktor> show me a lot of the basics of writing future programs. What I want
        viktor> to do is as follows:

        This sounds *very* much like homework. If it is, helping you would
        be cheating. Please don't ask us to help you cheat.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • viktor.shaw
        ... I can assure you its not homework, I haven t been anywhere near a school in many years. I am however interested in learning perl. I just came up with the
        Message 3 of 6 , Feb 24, 2008
        • 0 Attachment
          --- In perl-beginner@yahoogroups.com, merlyn@... wrote:
          I can assure you its not homework, I haven't been anywhere near a
          school in many years. I am however interested in learning perl. I
          just came up with the idea because it seemed like something simple
          enough yet would also use different types of statements and
          commands. Is this the type of reaction I can expect from any
          question I ask on this group?

          Viktor Shaw
          NSA-CSS


          > >>>>> "viktor" == viktor shaw <viktor.shaw@...> writes:
          >
          > viktor> The program I want to start out with should be easy enough
          and should
          > viktor> show me a lot of the basics of writing future programs.
          What I want
          > viktor> to do is as follows:
          >
          > This sounds *very* much like homework. If it is, helping you would
          > be cheating. Please don't ask us to help you cheat.
          >
          > --
          > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
          777 0095
          > <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
          > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
          > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
          training!
          >
        • merlyn@stonehenge.com
          ... viktor I can assure you its not homework, I haven t been anywhere near a viktor school in many years. I am however interested in learning perl. I
          Message 4 of 6 , Feb 24, 2008
          • 0 Attachment
            >>>>> "viktor" == viktor shaw <viktor.shaw@...> writes:

            viktor> I can assure you its not homework, I haven't been anywhere near a
            viktor> school in many years. I am however interested in learning perl. I
            viktor> just came up with the idea because it seemed like something simple
            viktor> enough yet would also use different types of statements and
            viktor> commands. Is this the type of reaction I can expect from any
            viktor> question I ask on this group?

            Only when it smells like homework.

            If you want a series of much more attainable programs, I'd suggest
            using one of the tutorial books. Beginning Perl is free, and on the
            net. My own Learning Perl has recieved rave remarks over the years.

            In my professional opinion as a Perl trainer for over a decade, the program
            you proposed will *not* be a good starting point to learn the beginnings of
            Perl. You will very likely need to use advanced constructs such as array and
            hash references, and that's really not a good thing for a first program.

            Heck, it'd take *me* over an hour to code that, and get it all correct.
            And I code pretty fast. :)

            Looks like about 500 lines of code, or possibly 100 lines if I can use the
            Games::Cards module from the CPAN. Definitely *not* a beginner program.
            You'd be lucky to learn all the pieces of how to make it work in under 40
            hours, and even then, it'd be frustrating every step of the way.

            That's why it smelled like homework. It's a great final exam question for a
            40-hour class. But not for a beginner.

            --
            Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
            <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
            Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
            See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
          • Rob Richardson
            Viktor, In just about any programming discussion group I ve seen, specific questions are much more likely to get answers than general ones. If you try to
            Message 5 of 6 , Feb 24, 2008
            • 0 Attachment
              Viktor,

              In just about any programming discussion group I've seen, specific questions
              are much more likely to get answers than general ones. If you try to write
              your card arithmetic program and come to some point where Perl says your
              code has a syntax error but it looks just fine to you, or it looks as though
              your program should be giving an answer of 13 and it's giving an answer of
              42, we can probably help. That's especially true if you can show us the
              code you have written. But there's really nothing to grab hold of in your
              question. You haven't gotten to Perl yet; you haven't even designed the
              program.

              And yes, you'd get a response of "That sounds like homework" to this
              question from just about any programming discussion group I've seen.

              RobR


              [Non-text portions of this message have been removed]
            • Bob Kardell
              There is a Games::Cards module? Heck, all this time I have been using Perl for work! Bob ... From: merlyn@stonehenge.com To:
              Message 6 of 6 , Feb 28, 2008
              • 0 Attachment
                There is a Games::Cards module? Heck, all this time I have been using Perl for work!

                Bob



                ----- Original Message ----
                From: "merlyn@..." <merlyn@...>
                To: viktor.shaw <viktor.shaw@...>
                Cc: perl-beginner@yahoogroups.com
                Sent: Sunday, February 24, 2008 4:07:41 PM
                Subject: Re: [PBML] Starting Out

                >>>>> "viktor" == viktor shaw <viktor.shaw@ nsa-css.org> writes:

                viktor> I can assure you its not homework, I haven't been anywhere near a
                viktor> school in many years. I am however interested in learning perl. I
                viktor> just came up with the idea because it seemed like something simple
                viktor> enough yet would also use different types of statements and
                viktor> commands. Is this the type of reaction I can expect from any
                viktor> question I ask on this group?

                Only when it smells like homework.

                If you want a series of much more attainable programs, I'd suggest
                using one of the tutorial books. Beginning Perl is free, and on the
                net. My own Learning Perl has recieved rave remarks over the years.

                In my professional opinion as a Perl trainer for over a decade, the program
                you proposed will *not* be a good starting point to learn the beginnings of
                Perl. You will very likely need to use advanced constructs such as array and
                hash references, and that's really not a good thing for a first program.

                Heck, it'd take *me* over an hour to code that, and get it all correct.
                And I code pretty fast. :)

                Looks like about 500 lines of code, or possibly 100 lines if I can use the
                Games::Cards module from the CPAN. Definitely *not* a beginner program.
                You'd be lucky to learn all the pieces of how to make it work in under 40
                hours, and even then, it'd be frustrating every step of the way.

                That's why it smelled like homework. It's a great final exam question for a
                40-hour class. But not for a beginner.

                --
                Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
                <merlyn@stonehenge. com> <URL:http://www.stonehen ge.com/merlyn/>
                Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
                See PerlTraining. Stonehenge. com for onsite and open-enrollment Perl training!



                [Non-text portions of this message have been removed]
              Your message has been successfully submitted and would be delivered to recipients shortly.