Skip navigation.
Home
Your source for Perl tips, howto's, faq and tutorials
( categories: )

i have to open 1 file & copy in other file with interchange line no.
for example :
file1.txt
hi
how are you
i am
here
file2.txt
how are you
hi
here
i am
i solution of it i am having. i want other one.

open (FF,"filename.txt"); # assume file is having 6 lines
@array=;
open (FF1,">file2write.txt");

for ($i=0;$i<=6;$i++)
{

if($i%2==0)
{
print FF1, @array[$i+1];
}

if ($i%2==1)
{
print FF1,@array[$i-1];
}
any other way 2 do diz operation