title: perl - parse error using composed script
body: <p>when i use this script , its working fine
  i use HTML::TreeBuilder to parse html from a site</p>
  
  <pre><code>#!/usr/bin/perl -w
  use LWP::Simple;
  use HTML::TreeBuilder;
  
  use open ':std', ':encoding(UTF-8)';
  my $base='https://myanimelist.net';
  my $url="/anime/35849/Darling_in_the_FranXX";
  my $page = get($base.$url) or die $!;
  my $p = HTML::TreeBuilder-&gt;new_from_content( $page );
  
  my @trips= $p-&gt;look_down(_tag=&gt;'span',itemprop=&gt;'description')-&gt;as_text;
  foreach my $trip (@trips){
     print $trip;
  }
  </code></pre>
  
  <p>but when i add it to this script it doesn't work</p>
  
  <pre><code>#!/usr/bin/perl -w
  use LWP::Simple;
  use HTML::TreeBuilder;
  my $ua = LWP::UserAgent-&gt;new();
  
  
  my $mal = "https://myanimelist.net/search/all?q=darling";
  my $response = $ua-&gt;request(HTTP::Request-&gt;new(GET =&gt; $mal));
  my $rrs = $response-&gt;content;
  while ($rrs =~ m/href=\"https:\/\/myanimelist.net\/anime\/(.*?)\" class=\"hoverinfo_trigger fw-b fl-l\"/g){
  my $link = $1;
  if ( $link !~ /video|season?_location=mal_h_m/ ) {
  print ("https://myanimelist.net/$link\n");
  
  use open ':std', ':encoding(UTF-8)';
  my $base='https://myanimelist.net';
  $fullink = "$link";
  my $page = get($base.$fullink) or die $!;
  my $p = HTML::TreeBuilder-&gt;new_from_content( $page );
  
  my @trips= $p-&gt;look_down(_tag=&gt;'span',itemprop=&gt;'description')-&gt;as_text;
  foreach my $trip (@trips){
     print $trip;
  }
  }
  }
  </code></pre>
  
  <p>and i get this error code :</p>
  
  <pre><code>Invalid argument at name.pl line 19.
  </code></pre>
  
  <p>is there any way to fix it?</p>