Hi,
I have a file.txt, I need to enter the data in string. Currently my code looks like this,
#!/usr/bin/perl
open myfiles, "file.txt" or die "couldn't find file: $!";
while (<myfiles>){
$string .= $_;
}
print $string;
close(myfiles);
The output when I print the string is like
hello.c
work.c
office.c
Is it possible to get the output of the string ot be in 1 line with spaces such as
hello.c work.c office.c
If there is a was which can place the data in the string initially like this or if there is a way I can manipulate the string it will be really helpful.
Thanks,
Rahul