如何将单个解析行写入段落?
我使用 XML::Simple 解析器提取了一个段落。我用一行解析了它。这是代码和我提取的摘要。
use LWP::Simple;
use XML::Simple;
use Data::Dumper;
open (FH, ">:utf8","xmlparsed2.txt");
my $db1 = "pubmed";
my $q = 16404398;
my $xml = new XML::Simple;
$urlxml = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=$db1&id=$q&retmode=xml&rettype=abstract";
$dataxml = get($urlxml);
$data = $xml->XMLin("$dataxml", ForceArray => [qw( MeshHeading Author AbstractText )], ForceContent=>1);
print FH Dumper($data);
print FH "Abstract: ".join "\n", map {join ":",($_->{NlmCategory},$_->{content})} @{$data->{PubmedArticle}->{MedlineCitation}->{Article}->{Abstract}->{AbstractText}};
我的问题是:是否可以对其进行解析以适合窗口并位于段落中而不是一行中?
I extracted a paragraph using XML::Simple parser. I got it parsed in a single line. Here is the code and I extracted abstract.
use LWP::Simple;
use XML::Simple;
use Data::Dumper;
open (FH, ">:utf8","xmlparsed2.txt");
my $db1 = "pubmed";
my $q = 16404398;
my $xml = new XML::Simple;
$urlxml = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=$db1&id=$q&retmode=xml&rettype=abstract";
$dataxml = get($urlxml);
$data = $xml->XMLin("$dataxml", ForceArray => [qw( MeshHeading Author AbstractText )], ForceContent=>1);
print FH Dumper($data);
print FH "Abstract: ".join "\n", map {join ":",($_->{NlmCategory},$_->{content})} @{$data->{PubmedArticle}->{MedlineCitation}->{Article}->{Abstract}->{AbstractText}};
My question is: can it be parsed to fit the window and be in a paragraph rather than in a single line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的问题是它可以被解析以适合窗口
那么问题1,如何确定终端窗口的大小
答案是使用
并且是在段落中而不是在一行中?
对于问题 2,使用核心模块 Text::Wrap 或 Text::Fold ...
My question is can it be parsed to fit the window
So question 1, how to determine the size of terminal window
The answer is use
and be in paragraph rather than in a single line?
for question 2, use core module Text::Wrap, or Text::Fold ...