I have a text file called news.txt and it contains the following:
Testing
Testing 2
I want each line display by new line. I used the following:
open(FILE, "news.txt"
;
@warnings = <FILE>;
close(FILE);
foreach $warnings (@warnings) {
$warns .= "$warnings\n";
}
When i run it, it shows like this:
Testing Testing 2
But i want it displays like this:
Testing
Testing 2
Any ideas?
I also tried the following but it doesn't work:
foreach $warnings (@warnings) {
$warns .= $warnings;
$warns .= "\n";
}
Testing
Testing 2
I want each line display by new line. I used the following:
open(FILE, "news.txt"

@warnings = <FILE>;
close(FILE);
foreach $warnings (@warnings) {
$warns .= "$warnings\n";
}
When i run it, it shows like this:
Testing Testing 2
But i want it displays like this:
Testing
Testing 2
Any ideas?
I also tried the following but it doesn't work:
foreach $warnings (@warnings) {
$warns .= $warnings;
$warns .= "\n";
}