in reply to array of arrays

Yikes. I reformatted, made your single A an AoA using array references, and made some little changes. You weren't handling the regex-ed data at all. This is totally untested, but then - so was yours. I suggest showing us some of your input to improve that regular expression (just anchoring it would be nice), and consistently using whitespace metacharacters.

#!/usr/bin/perl use strict; use warnings; open (FILE, 'interpro2go.txt') || die 'cannot open file'; my @i2g; foreach my $line (<FILE>) { if ($line =~ /\s*InterPro\:(\S+)\s(.+) > (.+) ; (.+)/) { push @i2g, [$1, $2, $3, $4]; } } print @i2g; close FILE; exit 0;