LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   User Type in Input in File1. File2 Runs to See if The String Matches Strings in Hash (https://www.linuxquestions.org/questions/linux-newbie-8/user-type-in-input-in-file1-file2-runs-to-see-if-the-string-matches-strings-in-hash-4175526536/)

newbi2014 11-25-2014 11:56 PM

User Type in Input in File1. File2 Runs to See if The String Matches Strings in Hash
 
Hi, all. I'm still new with perl. Questions:

file1 is where user can type in inputs.

file2 contains hash where
'a' => 1, 'b' => 2, 'c' => 3

I need to write a script in file2 which can take the input from file1 and compare with strings in hash in file2.

If the input from file1 are
a
e

file2 will display output
1
not valid

How do I take input from file1? I'm thinking of copying file1 to file2 but maye it's not right.

Thanks in advance.

grail 11-26-2014 08:28 PM

http://www.lmgtfy.com/?q=How+do+I+ta...m+file+in+perl

Surely one of these answer could have helped?


All times are GMT -5. The time now is 12:13 PM.