Global symbol "$element" requires explicit package name (did you forget to declare "my $element"?) at 1203983.pl line 14. Global symbol "@element" requires explicit package name (did you forget to declare "my @element"?) at 1203983.pl line 16. Global symbol "@element" requires explicit package name (did you forget to declare "my @element"?) at 1203983.pl line 17. Missing right curly or square bracket at 1203983.pl line 21, at end of line syntax error at 1203983.pl line 21, at EOF Execution of 1203983.pl aborted due to compilation errors. #### use strict; use warnings; use feature 'say'; use Test::More tests => 1; # my $filename = 'gff.annotated.gtf'; # open(my $fh, '<:encoding(UTF-8)', $filename) # or die "Can't open $filename: $!"; my $fh = \*DATA; my @transcript_ids; while ( my $line = <$fh> ) { my @columns = split / /, $line; if ( $columns[16] =~ /^[uxis]$/ ) { push @transcript_ids, $columns[10]; } } is_deeply( \@transcript_ids, [qw/ bb cc dd ee /], 'the right lines were matched' ); __DATA__ 1: 01 02 03 04 05 06 07 08 09 aa 11 12 13 14 15 a 2: 01 02 03 04 05 06 07 08 09 bb 11 12 13 14 15 u 3: 01 02 03 04 05 06 07 08 09 cc 11 12 13 14 15 x 4: 01 02 03 04 05 06 07 08 09 dd 11 12 13 14 15 i 5: 01 02 03 04 05 06 07 08 09 ee 11 12 13 14 15 s 6: 01 02 03 04 05 06 07 08 09 ff 11 12 13 14 15 z