I am writing a simple Perl script (on Windows) to download a get request response to a file URL. Pretty straightforward. Unless it is written to the output file, I get extra line breaks. So instead of:
<head> <title>title</title> <link .../> </head>
I get
Here's the Perl script:
use LWP::Simple; my $url = $ARGV[0]; my $content = get($url); open(outputFile, '+>', $ARGV[1]); print outputFile $content; close(outputFile);
I guess I can just get wget for Windows , but now it bothers me. How do I get rid of extra gaps ??
>+
LWP::Simple
getstore
:crlf
\n
\r\n
binmode
:raw
, $content CRLF, IO Perl LF → CRLF. (Internally, "\n" - Perl, LF).
$content
binmode(outputFile);
open, $content.
open
chomp ($ content) . , \n.
EDIT: , , chomp , , , chomp chomp , , , \n\n ? , . : , - , 2+\n, 2+\r, . \n , , ()
$content = ~ s/[\n\r] +/\n/g;
EDITED , ! -.... ,
Source: https://habr.com/ru/post/1769553/More articles:Hex code for Control + Question Mark? - cgethitRect (), I am doing it wrong, how does it work? - androidConnecting to an Informix Database Using SQL Management Studio - informixИнтеграция селена с помощью Jmeter или Grinder - seleniumкак я могу получить имя пользователя, который начал сборку в hudson - javaAhhhhh! Where did the form go? - formsReturn Values PLSql - stringEclipseLink / JPA: some @DiscriminatorColumn annotations for Entity - javaMaximum size in conjunction with previous Oracle - oracleHow to have pending build steps in MSBuild / TFS - tfsAll Articles