Hi Monks! I have a file which i read and extract information from it, the file contents is as follows:
DATA Numbers five; Crystal; Reliable chromo; Onion; Apple;
CHEM Synechocystis sp. PCC 6803 substr. Kazusa
NAMES Synechocystis sp. PCC 6803 substr. Kazusa
Bacteria; Cyanobacteria; Synechococcales; Merismopediaceae
Synechocystis; unclassified Synechocystis.
I am extracting only DATA and its corresponding values. For this i wrote the following program.
open(FH, "/Users/Desktop/file.txt") or die;
my $content = join("", <FH>);
my @matches = $content =~ /DATA\s+([A-Za-z\W]+)\n/g;
Now everything works file but i want to use a subroutine for this task, where the subroutine takes as input argument the content of the file and returns all data (DATA) from the file. In the return argument only the DATA should be included and nothing else.
How can i achieve this? any inputs will be appreciated a lot :)