Skip to content

Commit

Permalink
Code Optimization in sub ip_rfc1918. 😄
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanGibbs3 committed Jan 1, 2019
1 parent ef7b203 commit 9164135
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions iptoip
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,7 @@ sub get_ip {
sub ip_rfc1918 { # RFC 1918 Check
my $IP = shift;
my $RET;
if ( $IP=~m/^(192\.168\.|10\.|172\.((1[6-9])|(2\d)|(3[01]))\.).*$/ ){
# Fix this use of special Var :-(
# $_ = $IP;
# Fix this line to not req $_ :-(
# if(/^192\.168\..*$/ || /^10\..*$/ || /^172\.((1[6-9])|(2\d)|(3[01]))\..*$/) {
if ( $IP=~m/^(10|192\.168|172\.((1[6-9])|(2\d)|(3[01])))\..*$/ ){
$RET = 1;
}else{
$RET = 0;
Expand Down

0 comments on commit 9164135

Please sign in to comment.