Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Comparision Utility PERL

by hippo (Abbot)
on Feb 09, 2018 at 09:02 UTC ( #1208787=note: print w/replies, xml ) Need Help??


in reply to Comparision Utility PERL

Kindly guide

Since it's trivial:

for my $fieldnum (0 .. $#fields) { if ( exists $hash{ $fields[$fieldnum] } ) { print $fh "$row\n"; next; } }

Untested, since the original code provided is not an SSCCE.

Update: Note that vighneshmufc has altered the parent post to change the spec. This and the rest of the subthread may make less sense than originally.

Replies are listed 'Best First'.
Re^2: Comparision Utility PERL
by vighneshmufc (Acolyte) on Feb 09, 2018 at 09:08 UTC
    UPDATE
    i didnt understand this what did you do ?
    i need to run this file as perl filename.pl file1 file2 file3 Col2 col3
    i am very new to this . Also i reduced the sample.

      I have added a loop so that your comparison of one field against the row becomes a comparison of all fields against the row. That is what you wanted, no?

      Have a look at each statement in that block one by one. If you don't understand anything there, try to find it in the documentation with perldoc. If you still don't understanding it you can say so here, specifying where you looked and how the documentation you read did not make it clear. You may also peruse the Tutorials here for further guidance.

      Happy learning!

        ok ignore the file3 it was basically for just saving the result to a new file. where can i get the syntax for passing arrays as a command line argument?
        i need to run this file as perl filename.pl file1 file2 file3 Col2 col3
        i am very new to this . Also i reduced the sample.
        i am not quite able to grasp what you meant because i need to use command line arguments

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1208787]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2018-02-24 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (310 votes). Check out past polls.

    Notices?