Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IP address matching

Status
Not open for further replies.

sammy100

Programmer
Jul 24, 2001
21
US
i have a file that contains a list of IP addresses like:

20.45.76.196
15.76.96.156
21.34.56.146
...etc

how do i compare each entry in this file to check if it matches with the input that the user has given. the input given exists in the variable $in{IP}
does anyone know how to do this? please help. thx a lot.

Regards
Samantha
 
Try this:


open(FILEHANDLE, "/path/to/your/file");

while ( $input = chomp <FILEHANDLE> )
{
if($in{IP} eq $input)
{
print(&quot;$in{IP} equals $input \n&quot;);
}
}


close(FILEHANDLE);


I hope it works,
Marcus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top