I am trying to add all the elements in array using push . then i stored into another file
but begining of file i am seeing one whitespeace in every thing ..
What is the issue .. any one before face this issue .
open FILE , "a.txt"
while (<FILE>)
{
my $temp =$_;
push @array ,$temp;
}
close(FILE);
open FILE2, "b.txt";
print FILE2 "@array";
close FILE2;
When you quote an array variable like this:
"@array"it gets interpolated with spaces. That’s where they come from in your output. So do not quote if you do not need or want this sort of interpolation.Now let’s rewrite your program to modern Perl.