Btw this i'm just coding for fun.
Maybe then you don't need our help? and we should spend our time on people who are coding because they are trying to learn, or trying to earn a living, or trying to help someone else earn a living? Or even trying to fulfill a life-long dream as software inventor?
I would hope that you are trying to learn something from this "fun". What output are you getting? What do you mean "doesn't work"? We can't read your mind.
If I were to make a vague guess here, you are trying to read three things (name, age, gender) from STDIN. You then print out three new lines to STDOUT. You think that printing those new lines should send stuff to STDIN. And that the stuff will be automatically read and printed out in the final three lines, just as if you hit the return key 3x on the keyboard.
If so, some points to note:
- chomp($name... female;} is not some sort of form definition that only gets activated when you issue the print "\n\n\n" or the <> at the bottom of your sample code. I can see how someone used to working with HTML might think that way, but this is procedural code. The steps happen in the same order that you write them. If you don't send something to standard in via the key board or command line, your program will hang at the first chomp($name=<>).
- print "\n\n\n" sends data to STDOUT. This is a separate stream from STDIN (the thing that <> reads from). Even if the program reached this line (which it won't because it hangs at the first chomp($name=<>)), data sent to STDOUT would normally never be seen by something reading from STDIN.
Best, beth
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.