如何修复全局符号需要使用Perl显式包? [英] How to do fix the global symbol requires explicit package using Perl?

查看:83
本文介绍了如何修复全局符号需要使用Perl显式包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码抛出错误如下:



the following code throws an error as follows:

Global symbol "%href_to_what" requires explicit package





如何解决?



我尝试了什么:





How can i fix it?

What I have tried:

<pre>while (my $line=<$fh>) {
    chomp $line;
    for($line)
    {
    s/\&//g;
    s/[\\\_\@\_]//g;
    s/COMMENT//g;
    }
    my @data = split /:/, $line;
    my $class = $data[0] ? 'normal' : 'bold';
    print $fh_out qq[<tr class="$class">];
    my $ct=0; 
    for my $word(@data){ 
      $ct++; 
      print $fh_out '<td>';
      if ($ct==1){ 
          print $fh_out '<a href="'
                       .$href_to_what{$word}
                       .'">'; 
          } 

      print $fh_out $word; 
      if ($ct==1){ 
          print $fh_out '</a>';
          } 
      print $fh_out '</td>'; 
      } 
    print $fh_out "</tr>\n";
    } 

推荐答案

line =<
line=<


fh>){
chomp
fh>) { chomp


line;
for(
line; for(


这篇关于如何修复全局符号需要使用Perl显式包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆