Note that there are some explanatory texts on larger screens.

plurals
  1. POOdd subroutine compilation errors in Perl script
    text
    copied!<p>Two pieces of ASCII text (one L = long and one S = short) were read into @arrayOne and @arrayTwo, respectively, for comparison. The following subroutine &amp;analyse gets two array references from the smart.pl code, but throws an error when checked via perl -c smart.pl. Unfortunately I can't figure out why: </p> <pre><code>68 sub analyse { 69 my $arraysize ; my $arrLref ; my $arrSref ; my $item_L ; my $item_S ; my $value ; 70 71 $arrSref = shift ; $arrLref = shift ; 72 $item_S = shift @{ $arrSref } ; 73 $item_L = shift @{ $arrLref } ; 74 75 $arraysize = $#{ $arrSref } ; 76 while ( $arraysize &gt; 0 ) { 77 $value = ( $item_S cmp $item_L ) ; 78 given ( $value ) { 79 when ( -1 ) { 80 push ( @mergedArray , $item_S ) ; 81 $item_S = shift @{ $arrSref } 82 } 83 when ( 0 ) { 84 push ( @mergedArray , $item_L ) ; 85 $item_S = shift @{ $arrSref } ; 86 $item_L = shift @{ $arrLref } 87 } 88 when ( 1 ) { 89 push ( @mergedArray , $item_L ) ; 90 $item_L = shift @{ $arrLref } 91 } 92 default { &amp;die } 93 } 94 } 95 } </code></pre> <p>Compilation is aborted with the following statements: </p> <pre><code> $ perl -c smart.pl syntax error at smart.pl line 78, near ") {" syntax error at smart.pl line 83, near ") {" syntax error at smart.pl line 88, near ") {" Global symbol "$item_L" requires explicit package name at smart.pl line 89. Global symbol "$item_L" requires explicit package name at smart.pl line 90. Global symbol "$arrLref" requires explicit package name at smart.pl line 90. syntax error at smart.pl line 91, near "}" smart.pl had compilation errors. </code></pre> <p>Maybe someone else has a clue? Thx in advance –DrP-</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload