It seems thatCode, Passed the test
# ! /Usr/bin/perl Sub Func1 { Print " Func1 is running \ n " ;} Sub Func_test { My $ Func_ref = Shift ; # Ref will return 'code' if it's function reference If (( Ref ( $ Func_ref ) Eq " Code " ) && Defined (&{ $ Func_ref })){ &{$ Func_ref }; Print $ @ If $ @;} Else { Print " Not real function was called! \ N " ;}} # # Testing from here My $ Func_ref = \& Func1; My $ Anoy_ref = Sub { Print " Anonymous function is running \ n " }; My $ VaR = " ABCD " ; My $ Var_ref = \ $ VaR ; Func_test ( $ Func_ref ); Func_test ( $ Anoy_ref ); Func_test ( $ VaR ); Func_test ( $ Var_ref )
My $ Variablename=10 #Define private variables
Function test {My $=Shift;}#The function parameter is actually an array # shift Delete and return the first element of the array
The code before modification:
# ! /Usr/bin/perl # Passing Parameter Test Sub Hello { My $ =Shift ; Print $ ;} & Hello ( " Hello, world \ n " ); # Return Value Test Sub Max { My $ = Shift ; My $ B = Shift ; If ( $ > $ B ){ Return $ ;} Else { Return $ B ;}} $ N = & MAX ( 10 , 23 ); Print $ N ; Print " \ N " ;