Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Comparision Utility PERL

by hippo (Canon)
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
    i didnt understand this what did you do ?
    i need to run this file as perl 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 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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2018-11-13 23:02 GMT
Find Nodes?
    Voting Booth?
    My code is most likely broken because:

    Results (159 votes). Check out past polls.