# 1148750 print "Testing IP Addresses in array, \@ip: \n"; my @ip = ("0123.456.789.654", "a123.456.789.654", "123.456.789.6543", "111.222.333.444") ; for $ip (@ip) { if ( $ip =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { print "yes $ip has a match: $1 $2 $3 $4\n"; } else { print "no match\n"; } } print "\n\t whereas, with anchors in the ip, \n"; for $ip(@ip) { if ( $ip =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) { print "Second regex matches $1 $2 $3 $4\n"; } else { print "no match in $ip \n"; } } =head execution results: Testing IP Addresses in array, @ip: yes 0123.456.789.654 has a match: 123 456 789 654 yes a123.456.789.654 has a match: 123 456 789 654 yes 123.456.789.6543 has a match: 123 456 789 654 yes 111.222.333.444 has a match: 111 222 333 444 whereas, with anchors in the ip, no match in 0123.456.789.654 no match in a123.456.789.654 no match in 123.456.789.6543 Second regex matches 111 222 333 444 =cut