Jump to content
Tuts 4 You

Perl error


CodeExplorer

Recommended Posts

Posted

Perl error
having gen-kernel.pl file
and this declaration:

my $code = "";
...
my $output = shift;
open STDOUT,">$output" or die "can't open $output: $!";

$code .= <<EOF;
    ; finalize the computation of A,B,C,D
    iadd r0, r0, r23
    iadd r1, r1, r24
    iadd r2, r2, r25
    iadd r3, r3, r26
    ; compute x,y (x = A; y = C - D)
    mov r21, r0
    iadd r22, r2, r3_neg(xyzw)
    ; decrement loop counter
    iadd r4.x, r4.x, l100.y
  endloop

  umul r5.x, vaTid.x, l100.w
  mov g[r5.x+2], r21
  mov g[r5.x+3], r22
  ; increment the 4 iteration counters
  iadd r5.y, l100.x, r4_neg(x).x
  iadd g[r5.x+4], g[r5.x+4], r5.yyyy
end
\x00
EOF
print $code;

The error is this: Use of uninitialized value value in concatenation (.) or string at gen-kernel.pl line 219.
How to fix the error, sorry but I am null at Perl programming!

 

Posted

It works for me. Does line 219 refer to the one with $code .= <<EOF;? Maybe the problem stems from the part where you denoted as ...

Posted

my $output = shift;
open STDOUT,">$output" or die "can't open $output: $!";
$code .= <<EOF;

Use of uninitialized value value $output in concatenation (.) or string at gen-kernel.pl line 219.
line 219 is "open STDOUT,">$output" or die "can't open $output: $!";"
My guess now is that the error is at the line: my $output = shift;

I've read a tutorial:
https://perlmaven.com/shift
https://www.perlmonks.org/?node_id=88222

and yeah shift is empty!
But also shift contains program parameters,
so
perl.exe gen-kernel.pl kernel.il
will do the trick!
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...