Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
go ahead... be a heretic
 
PerlMonks  

Re^3: adding a return to a file

by AlexanderTheGreat (Initiate)
on May 17, 2012 at 16:21 UTC ( #971105=note: print w/ replies, xml ) Need Help??


in reply to Re^2: adding a return to a file
in thread adding a return to a file

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; }


Comment on Re^3: adding a return to a file
Download Code
Re^4: adding a return to a file
by AlexanderTheGreat (Initiate) on May 21, 2012 at 11:48 UTC

    I have solved my problem with the split command thank you all for your help

    AlexanderTheGreat

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971105]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2013-05-18 15:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (392 votes), past polls