#!/usr/bin/ruby require 'ipaddr' puts "Enter an IP Address" ip = gets.chomp if ip.ipv4?(ip) puts "#{ip}" else puts "invalid" end