Hi and thanks for playing! :-)
Ok so it would seem (from the output..or lackthereof) of the debugging statements that the loop isn't even being entered. But _why_?
here's the current state of affairs:
#!/usr/bin/perl
#
use strict;
#
#
my $workdir = "$ENV{HOME}/txt";
open (BADIPS), "< $workdir/bad_ips" or die "Couldn't open file: $!";
print "Can you hear me now?\n";
while (my $line = <BADIPS>) {
chomp $line;
print "add ns simpleacl bp-search-spammer DENY -srcIP $line -TTL
+ 43200";
print "Can you hear me now?\n";
}
close BADIPS;
This is what the output looks like:
[bluethundr@lcent5-1:~/perl] $:./bad_ips.pl
Can you hear me now?
And I hear what you're saying about the input file (bad_ips) potentially being empty. But I gotta tell ya, it sure doesn't look that way to me! I am able to open the file and here is the output of ls:
[bluethundr@lcent5-1:~/txt] $:ls -l bad_ips
-rw-r--r-- 1 bluethundr bluethundr 822 Jun 5 04:24 bad_ips
any thoughts? tx again!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.