Make a random IP address in Perl
This Perl script makes reasonably convincing random IPv4 internet addresses.
#!/home/ben/software/install/bin/perl use warnings; use strict; sub randomip { my @digits; for (0..3) { push @digits, int (rand (255) + 1); } return join '.', @digits; } for (0..9) { print randomip (), "\n"; }
The output looks like this:
241.115.90.95 242.206.146.220 85.126.231.163 108.156.77.23 1.75.209.55 22.112.236.194 109.243.52.8 252.238.49.135 210.25.179.196 246.252.2.113
Copyright © Ben Bullock 2009-2023. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com) or use the discussion group at Google Groups.
/
Privacy /
Disclaimer