Thankfully, view source restores the newlines that html ignores when displaying.

Here's the OP's code, I think: (to the OP: always always *always* use preview first.)
#!/usr/bin/perl # ELink (batch) - EFetch use strict; use NCBI_PowerScripting; my (%params, %links); my @db = qw(protein nucleotide, gene); my $link; my $dir ='/home/'; opendir (DIR,$dir)or die $!; while (my $file = readdir (DIR)) { next unless (-f "$dir/$file"); next unless ($file =~m/\. gi$/); my @data; open (MYFILE,$file) or die "cannot open $file:$!"; open (OUT,">$file.data") or die "cannot open $file:$!"; #ELink $params{db} = $db&#91;0&#93;; $params{id} = ''; %links = elink_batch_to($db<a href="?node=1">1</a>, %params); #EFetch foreach $link (keys %links) { %params = extract_links($link, %links); $params{outfile} = $link . '.dat'; $params{retmode} = 'text'; if ($link =~ /nuccore/) { $params{rettype} = 'fasta'; } efetch_batch(%params); print nuccore; }

In reply to Re: perl - loop by ssandv
in thread perl - loop by annymous

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.