$_ = '1: A silly sentence (495,a) *BUT* one which will be useful. (3)'; print "Enter a regular expression: "; my $pattern = ; chomp $pattern; if (my @matches = /$pattern/) { for my $i (0..@-) { print "$i: $matches[$i]\n"; } }