#!/usr/bin/perl use strict; use warnings; my $file = $ARGV[0] or die "Usage: $0 "; open(my $fh, '<', $file) or die "Unable to open '$file' for reading: $!"; my $header = <$file>; chomp $header; my @field = split /:/, $header; print "What field would you like to look for?\n"; my $choice = ; chomp $choice; while (<$fh>) { chomp; my %record; @record{@field} = split /:/; print "$record{$choice}\n"; }