my $file = '...the OPs File example..." #used as a string # to simplify my # test my @gi_ids = $file =~/gi\|(\d+)\|/g;