Here is a display portion of what you want to do:
#!perl -w
while ( <DATA> ) {
chomp;
printf "definition1 %s\ndefinition2\ndefinition3\ndefinition4:%s\n", $_, $_;
}
__DATA__
name1
name2
^------ Script ends here
Output:
definition1 name1
definition2
definition3
definition4:name1
definition1 name2
definition2
definition3
definition4:name2
You should be able to add the fileout, etc. It is easier here to use __DATA__
vs creating a file.
Wags ;)
-----Original Message-----
From: Anand, Pankaj [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:18
To: 'Beginners (E-mail)
Subject: change the format of file.
Hi ,
I want to make a perl script which can take the input from a file which is
in this form -
name1
name2
I want to change it to this format -
definition1 name1
definition2
definition3
definition4:name1
definition1 name2
definition2
definition3
definition4:name1
and so on
Thanx
952)324-0422
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]