in reply to Reading from filehandles in a loop and matching lines

...does not simply start! Everytime it's executed it returns to command line.

Maybe it runs, but doesn't print anything, e.g. because the department ('R&D' as per comment in the code) is not passed in $ARGV[0], or passed incorrectly (at least on Unix, the argument would need to be quoted because of the & )?

Are you running it like this

$ ./838601.pl 'R&D'

When I do so, it prints " Patrick Reed".

(assuming you actually have tabs in your input file — which is hard to tell, as cut-n-pasting might have changed them to spaces...).

Replies are listed 'Best First'.
Re^2: Reading from filehandles in a loop and matching lines
by Nathan_84 (Acolyte) on May 06, 2010 at 01:57 UTC

    Hi, You were spot on with the tabs error! I'm so blond! Can't believe I didn't see that. Thanks.

    You the purpose of this script was so that it can do the following:
    1. Identifies the name, department and salary of the employee
    2. Ignores and goes to the next line if the employee is female (the name does not start with Mr)
    3. Ignores and goes to the next line if the salary is less or equal to 25000.
    4. Ignores and goes to the next line if the department is not "R&D".
    5. Prints the name and the salary of the employee on the screen.