Operating System - HP-UX
1752766 Members
5022 Online
108789 Solutions
New Discussion юеВ

This is really vexxing me!!

 
Tony Walker
Frequent Advisor

This is really vexxing me!!

Hi Guys,

Here's a rouch idea of what I'm doing.. Have a logfile, a file with a list of errors and a file with corresponding line numbers.
What I want to do is search for each error, and print it if the line number its on is greater than the one thats already recorded in the file. If an error is found I want to update the line number file with it.
This is currently working fine when I declare my array of errors explicitly within the script but I don't want to do that. I want to read the errors into an array and do the same as before. When I try this using a 'slurp' it only ever find 1 of the errors!!

Any help much appreciated.

Thanks,

Tony
p.s This is my first perl script so it may look rusty/illogical and there are probably many better ways to do it:)
3 REPLIES 3
Ken Penland_1
Trusted Contributor

Re: This is really vexxing me!!

well, I didnt work through your code to figure out what was broken...instead I just did what I would do if given the task you described...hope it helps ;P
'
Elmar P. Kolkman
Honored Contributor

Re: This is really vexxing me!!

Try using a hash for your errors instead of an array and you should be fine, I think.
Every problem has at least one solution. Only some solutions are harder to find.
Tony Walker
Frequent Advisor

Re: This is really vexxing me!!

Thanks for the help guys. I have since found out that I had merely missed out chomp(@entry); which solved all of my problems!

Tony