$cat foo apple apple pear pear zucchini zucchini eggplant eggplant potato potato $cat bar #!/usr/bin/perl $map{'apple'} = 'fruit'; $map{'pear'} = 'fruit'; $map{'zucchini'} = 'vegetable'; $map{'eggplant'} = 'vegetable'; $map{'potato'} = 'vegetable'; open FILE, "foo" or die$!; my @lines = ; while (my $line = ) { chomp; print "$map($_)\n";