in reply to formatting text prior to using it it to post to cgi...
Your indenting "needs work".
Don't you mean open(FILE, $file) instead of open(FILE,"fulldata")?
Why don't you move the chomp right below the while (<FILE>)? Actually, you don't need the chomp at all since you discard the end of the line.
Your if should be checking $ip, but it's checking $_.
/^192.168./ matches '19231681'. You want /^192\.168\./.
You don't need the split.
($ip) = (split /:/)[0]; if ($ip =~ /^192.168./) {
can be replaced with
if (/^(192\.168\.\d{1,3}\.\d{1,3}):/) { $ip = $1;.
You're closing INFO, yet your handle is FILE.
You don't check the results of request
Your original code sorted the results, but your Perl script doesn't.
|
|---|