#!/usr/bin/perl -w use strict; my @words; my $tries=0; while($tries!=2){ print "enter a new word:"; my $word=; chomp $word; if (grep{/$word/}@words) { print "$word already exists!\n"; $tries++; } else { push @words, $word; $tries=0; } } print "2 tries to enter a new word are up!\n"; print "Unique Words were:@words\n";