Rachit has asked for the wisdom of the Perl Monks concerning the following question:

I m new to perl programming and got stuck in doing some thing new. I have to text file in same location named name.txt and marks.txt In name.txt content mentioned like below Name(1)=abc Name(2)=xyz Name(3)=abc and so on. Similarly in marks.txt content is like Marks_achieved(1)=70 Marks_achieved(2)=80 Marks_achieved(3)=60 and so on Now I want that where name "abc" is found in "name.txt" the numbers mentioned against "abc" get stored in array and then it will search for value mentioned against in this numbers in marks.txt And finally my output like abc 70 abc 60 get dumped in new file. Please help me out. And thanks in advance

Replies are listed 'Best First'.
Re: Unable to store value in array??
by kcott (Archbishop) on Dec 09, 2015 at 22:33 UTC

    G'day Rachit,

    Welcome to the Monastery.

    Take a look at "perlintro -- a brief introduction and overview of Perl". That should probably have everything you need; if not, follow the links therein for more information, as required.

    Also, when posting here, please wrap data and code in <code>...</code> tags. That way, we can see the same thing as you. For instance, with what you've currently posted, we see name.txt as

    Name(1)=abc Name(2)=xyz Name(3)=abc

    However, I wonder if you're actually seeing

    Name(1)=abc Name(2)=xyz Name(3)=abc

    The code to handle those two file formats will be different.

    — Ken

      Hi Ken Thanks for your reply... I m looking for <Name(1)=abc> <Name(2)=xyz> <Name(3)=abc>
Re: Unable to store value in array??
by GotToBTru (Prior) on Dec 09, 2015 at 19:40 UTC

    Welcome to the world of programming, which is much better learned by doing than by hearing. Although of course you've got to start somewhere.

    1. I suggest going over the tutorials on this site.
    2. Work out the algorithm as steps in English, not necessarily as a program. How would you do it without a computer?
    3. Work out how to do what you describe in Perl.
    Post what you have, both steps and code, and we can guide you.

    Dum Spiro Spero