in reply to Please help me with this conditional loop on text entries.
HTH,#!/usr/bin/perl use strict; use warnings; use Regexp::Common qw /net/; use IO::Prompt; my $ip; # formatting the input while ( $ip = prompt "Enter a valid IP address: ", -until => qr/^$RE{n +et}{IPv4}{-sep=> '.'}$/ ) { print "Your say: '$_'\n"; } # dotted-quad format to hexadecimal my $hex_ip = unpack "H*", pack "C4", split '\.', $ip;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Please help me with this conditional loop on text entries.
by vsailas (Beadle) on Dec 14, 2007 at 10:03 UTC |