LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-26-2014, 12:56 AM   #1
newbi2014
LQ Newbie
 
Registered: Nov 2014
Posts: 15

Rep: Reputation: Disabled
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.
 
Old 11-26-2014, 09:28 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

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

Surely one of these answer could have helped?
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ask User for Input and See if The String Matches Strings in Hash newbi2014 Linux - Newbie 2 11-25-2014 07:51 PM
merge file1 at end of line file2 porkcharsui Linux - Newbie 2 03-23-2010 06:27 AM
Copy from file1 to file2 - Trying sed LinuxCrayon Linux - Newbie 3 03-30-2008 08:51 AM
[Comp] How to create a file from the differences between file1 and file2 Xeratul Linux - Software 2 11-19-2006 02:20 PM
Avoid cat file1>>file2 automatic add return after file2. AshesOfTime Programming 5 11-25-2004 08:27 AM


All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration