I am going to add my code so you guys can take a look at what i have so far

#! /usr/bin/perl use warnings; use strict; #opening the file that i am reading from open TEST, 'test.txt' or die $!; #saving the file as a hash my %test = <TEST>; #looping through the hash and printing out all the words # i am going to eventualy have the person enter a sylable to look up r +hyming words for (keys %test) { print "$_"; } # and then give the definition of the word that you type in print " Please Enter A Word "; my $choice = <STDIN>; #the vaariable to check if the word is in the file my $word = 10; for (keys %test) { #if it is print out the definition (the hash value) if ($choice eq $_) { print $test{$_}; $word = 1; } } close TEST; #if it is not then say sorry word not found and ask them to retype it +and a definition if ($word != 1) { open TEST, '>>test.txt' or die $!; print "Sorry Word Not Found\n"; print "Please Re-enter Word\n"; my $input = <STDIN>; print "Please Enter Definition\n "; my $def = <STDIN>; #append the word to the file print TEST "\n",$input; print TEST $def; }

In reply to Re^3: adding a return to a file by AlexanderTheGreat
in thread adding a return to a file by AlexanderTheGreat

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.