Question: how to extract data from text file using perl?
Answer: use strict;
use warnings;
use 5.012;
my $file = 'data. txt';
open my $fh, '<', $file or die "Could not open '$file' $!\ n";
while (my $line = <$fh>) {
chomp $line;
my @strings = $line =~ /(?:^|\s)([A-Za-z]+-\d+)(?:\s|$)/g;