perlnoobster has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl monks,
I was wondering if someone could help me, I have some coding that generates a text file, however there are blank rows that are being generated too, I just want to omit them and tried chomp but it didn't work so I tried using push @Results,$_ unless ($_ eq "\n"); and that didn't work, please can someone help me?
open (IN, "$output") or die "I couldn't get at $output"; my @Top_URLs = <IN>; foreach my $URL (@Top_URLs) { my $final_page = get "$URL";#grab the link urls get $url my @Results =(); push @Results,$_ unless ($_ eq "\n"); for my $Results (@Results) { if ($Results =~ s/.*\///) { print OUT2 "$Results\n"; } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Removing blank/empty lines
by toolic (Bishop) on Dec 11, 2012 at 14:03 UTC | |
by perlnoobster (Sexton) on Dec 11, 2012 at 14:20 UTC | |
by thmsdrew (Scribe) on Dec 11, 2012 at 15:18 UTC | |
by Anonymous Monk on Dec 11, 2012 at 15:14 UTC | |
by perlnoobster (Sexton) on Dec 11, 2012 at 17:18 UTC | |
Re: Removing blank/empty lines
by marquezc329 (Scribe) on Dec 11, 2012 at 17:37 UTC | |
by space_monk (Chaplain) on Dec 11, 2012 at 20:49 UTC | |
Re: Removing blank/empty lines
by Anonymous Monk on Dec 11, 2012 at 14:28 UTC | |
by Athanasius (Archbishop) on Dec 12, 2012 at 06:08 UTC |
Back to
Seekers of Perl Wisdom