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

Hi guys!

I have problem in reading a file and change it to get some specific output. For example : I want to read a file : filename.txt which contain 2 lines:

Data A 1 2 3 4 5

Data B 6 7 8 9 10

the name of the data and the values are tab separated. my wish is to change it into :

Data A = (1,2,3,4,5); Data B = (6,7,8,9,10);

Thanks in advanced for your kindly help!

Replies are listed 'Best First'.
Re: Changing the file
by moritz (Cardinal) on Mar 17, 2011 at 09:17 UTC

    So you need to read the input, extract the information you need (see for example split), construct a string in the new format (see for example join), and print it out. perlintro should help you getting started with Perl, and should teach you enough Perl to achieve your goal.

    When you have problems with a specific step, please ask again - but read How (Not) To Ask A Question first please.