Hi I have a file in the following format

111
222
333

Now I need to print the following output from the given input file as
111 222 333

Is there a way I can do this in perl?
I tried 2 ways (both ere essentially the same)

1) Parsing the file and pushing the inputs to a string array. However
since the inputs had a newline, I could n't remove them
2) Using the .="" operator to concatenate. Here too, the newlines from
the file were taken.

my $parent_loop;
my $line_cnt;
my @lines;
my @output;

open (FILE_PATTERN ,$ARGV[0]) || die ("ERROR: NO INPUT, NO OUTPUT
hahaha");

while (<FILE_PATTERN>) {
   push @lines, $_;
   $line_cnt++;
  }

close (FILE_AUDIO);


for ($parent_loop=0; $parent_loop < $line_cnt; $parent_loop++) {

 push @output,"$lines[$parent_loop]";
}
for ($parent_loop=0; $parent_loop <= $line_cnt; $parent_loop++) {
print $urg_command[$parent_loop];
}


Could someone let me know how I can remove the newline?

Thanks,
perl_baby


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to