rxlab
#!/usr/bin/perl
while (1)
{
$rgx = idemprompt("Regex? [%s] > ", $rgx);
$target = idemprompt("Target? [%s] > ", $target);
$cmd = "$target =~ m#$rgx#";
print("'$cmd' -> ");
@result = eval($cmd);
print("'", join(':', @result), "'nn");
}
#
# Prompt for a response. If none given, keep the previous value.
#
sub idemprompt
{
my ($prompt, $str, $value);
($prompt, $value) = @_;
printf($prompt, $value);
chomp($str = <STDIN>);
if ($str ne "")
{
$value = $str;
}
return $value;
}
Comments (0)
You don't have permission to comment on this page.