Clear questions and runnable code
get the best and fastest answer
Need help from the esteemed monks on scoping/hashesby garbage777 (Acolyte)
|on Jun 05, 2006 at 16:49 UTC||Need Help??|
garbage777 has asked for the
wisdom of the Perl Monks concerning the following question:
This is my first posting and I am relatively new to Perl. Hence please excuse if I failed to follow any posting rules.
I have a text file called "top.spef" that has the following lines -
Here is what I want to do -
1. I want to remove "*" wherever it occurs,
2. I want to store the lines in between "NAME_MAP" and "PORTS" into a hash.
3. I want to replace numbers 2, 3, 5 and 9 in second column in lines that contain "D_NET" with the corresponding values of keys 2, 3, 5 and 9 from hash in step#2 above .
In order to do this, I wrote a small script as below -
When I execute this code I get the following error -
I am assuming this error is issued by Perl because probably the hash %mapping scope may be not visible in the below part of the code -
Can you kindly suggest me what I am doing wrong and how to fix this problem ? I very much appreciate all your help in advance.
Best Regards, Dan