#!/usr/bin/perl use warnings; use strict; use Term::ReadLine; # for correction and command history you must have # Term::ReadLine::Gnu (from CPAN) installed my $term = new Term::ReadLine 'regular expression test'; my $pr1 = "string: "; my $pr2 ="regexp: "; my $OUT = $term->OUT || *STDOUT; while (1) { my $st=$term->readline($pr1); my $rg=$term->readline($pr2); if ($st =~ /$rg/) {print $OUT "$st contains $rg\n"} else {print "$st does not contain $rg\n"} }