How can I slurp STDIN in Perl?

后端 未结 5 1800
情话喂你
情话喂你 2021-02-07 08:06

I piping the output of several scripts. One of these scripts outputs an entire HTML page that gets processed by my perl script. I want to be able to pull the whole 58K of text

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 08:33

    To get it into a single string you want:

    #!/usr/bin/perl -w
    use strict;
    
    my $html_string;
    while(<>){
       $html_string .= $_;
    }
    
    print $html_string;
    

提交回复
热议问题