jnbill1204
New member
I am reading a text file in perl and trying to display the text but when I run the code below it doesn't create the new line. Can someone explain what I am doing wrong?
open (MYFILE, 'perlfile.txt');
while (<MYFILE>) {
chomp;
(my $u) = split("\t");
print "url: $u\n";
}
close (MYFILE);
Here is my full code:
use warnings;
use strict;
use Email::Find;
use LWP::Simple;
use HTML::LinkExtor;
use HTML::TokeParser;
use Data:
umper;
use URI::URL;
use Text::CSV;
use DBI;
open (INPUT, "perlfile.txt") or die "Can't open data file: $!";
my $line;
my $counter = 1;
my @fields;
while (<INPUT>) {
@fields = split('/\t/', $_);
print @fields;
$counter++;
}
close INPUT;
my text file looks like this:
http://www.yahoo.comhttp://wwww.google.com bing.com
It all being read as one big string and not splitting.
the out put ishttp://www.yahoo.comhttp://wwww.google.com bing.com in one string.
I can't figure it out
open (MYFILE, 'perlfile.txt');
while (<MYFILE>) {
chomp;
(my $u) = split("\t");
print "url: $u\n";
}
close (MYFILE);
Here is my full code:
use warnings;
use strict;
use Email::Find;
use LWP::Simple;
use HTML::LinkExtor;
use HTML::TokeParser;
use Data:

use URI::URL;
use Text::CSV;
use DBI;
open (INPUT, "perlfile.txt") or die "Can't open data file: $!";
my $line;
my $counter = 1;
my @fields;
while (<INPUT>) {
@fields = split('/\t/', $_);
print @fields;
$counter++;
}
close INPUT;
my text file looks like this:
http://www.yahoo.comhttp://wwww.google.com bing.com
It all being read as one big string and not splitting.
the out put ishttp://www.yahoo.comhttp://wwww.google.com bing.com in one string.
I can't figure it out