in reply to chomp removes everything *except* the newline?
Output:#!perl use strict; use warnings; my $File = "input.txt"; # this string wasn't quoted, so you must have +not shown us the code you're using open(FILE, "<", $File) or die qq(failed to open file "$File": $!); # y +ou didn't check whether open failed chomp(my @IPLIST = <FILE>); # this works as expected close(FILE); foreach my $test (@IPLIST) { print "Is $test an IP?\n"; }
Is 111.111.111.111 an IP? Is 222.222.222.222 an IP? Is 333.333.333.333 an IP?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: chomp removes everything *except* the newline?
by follier (Initiate) on Jun 26, 2010 at 18:41 UTC | |
by almut (Canon) on Jun 26, 2010 at 18:56 UTC | |
by GrandFather (Saint) on Jun 26, 2010 at 21:50 UTC |