http://www.perlmonks.org?node_id=380550

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I want a quick and easy way to check if a value looks like an IP address, i'm happy just to check if the variable holds 4 numbers separated by dots.

So far I have got

if ($Route=~m/\d\.\d\.\d\.\d/) { do something interesting with the IP address }

Any better way of doing this?

Cheers,Tom

20040808 Edit by castaway: Changed title from 'Perl regexp trickery'