How can I slurp STDIN in Perl?

后端 未结 5 1801
情话喂你
情话喂你 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:42

    I've always used a bare block.

      my $x;
      {
        undef $/; # Set slurp mode
        $x = <>;  # Read in everything up to EOF
      }
      # $x should now contain all of STDIN
    

提交回复
热议问题