只想知道在对同一子程序的多次调用中保留变量值的最佳方法是什么.即
$someList = &someRoutine(100, 200);
$someList2 = &someRoutine(100, 200);
sub someRoutine {
$someAddition = 0;
foreach $someSum (@_){
$someAddition += $someSum;
}
return $someAddition
}
print $someList;
print $someList2;
Run Code Online (Sandbox Code Playgroud)
基本上,someList应该打印300,someList2应该打印600.如何使someList2打印600?我希望在多个子程序调用中保留$ someAddition.
因为我对汇编很新,所以如果用户在汇编中输入大写字母或反之亦然,我有一些关于如何从小写转换为大写的问题.这是我到目前为止:
section .data
Enter db "Enter: "
Enter_Len equ $-Enter
Output db "Output: "
Output_Len equ $-Output
Thanks db "Thanks!"
Thanks_Len equ $-Thanks
Loop_Iter dd 0 ; Loop counter
section .bss
In_Buffer resb 2
In_Buffer_Len equ $-In_Buffer
section .text
global _start
_start:
; Print Enter message
mov eax, 4 ; sys_write
mov ebx, 1
mov ecx, Enter
mov edx, Enter_Len
int 80h
; Read input
mov eax, 3 ; sys_read
mov ebx, 0
mov ecx, In_Buffer
mov edx, In_Buffer_Len
int …Run Code Online (Sandbox Code Playgroud)