in reply to Can I make a sub for this?

Random style advice.

As perlstyle says, Always check the return codes of system calls.Good error messages should go to STDERR, include which program caused the problem, what the failed system call and arguments were, and (VERY IMPORTANT) should contain the standard system error message for what went wrong. So, for instance, where you write:

open INFILE, "$ARGV[0]";
you should write something like this:
open INFILE, "<", $ARGV[0] or die "Can't read '$ARGV[0]': $!";
And now if there is a problem opening that file, you'll get useful information.

Secondly you should familiarize yourself with strict.pm and apply what it says. That will catch a lot of typos in your code.

Thirdly you're using C-style for loops. Don't. Use Perlish for loops instead.

# I'd use a better variable than $line, but I don't know # what your purpose is, and your Tryptic names are quite # cryptic for me. for my $line (@aTryptic) { my $accSeq = SplitFields($line], 'split'); $line =~ s/\r?\n\z//g; $hTryptic{$accSeq} = $line; $line = $accSeq; }
This eliminates the possibility of off by one errors, is more efficient, and reduces possible typos.

Fourth, in question 2, either make all data chomped or all data unchomped. Having to call chomp on data randomly before comparing them is a red flag.

A more minor nit. I prefer using _ in variable names rather than camelCaseCapitalization.

Oh, and about question 2, rather than repeatedly scan an array, arrange to use a hash lookup.

my %in_array_b; @in_array_b{@array_b} = (); foreach my $one (@array_a) { print $in_array_b{$one} ? $hash_a{$one} : $hash_b{one}; }