#!/usr/bin/perl


#filename linear1.pl


use strict;

my @names=qw;
my $input;
my $i;

do
{
	print "Enter a name to find ";
	$input = ;
	chomp($input);


	# find the name in the array - linear search

	for($i=$#names ; $i>=0 ; $i--)
	{
		if ($names[$i] eq $input)
		{
			last;
		}
	}

	if ($i>=0)
	{
		print "Found at $i\n";
	}
	else
	{
		print "Name not found\n";
	}
} while ($input ne "stop");