perl - Passing a reference and a string into a subroutine -
i'm trying pass reference array, , string function in form;
&function2(\g_array, "string");
in subroutine want deference array can evaluate/print it, when try complains can't map string array while using strict. best method this?
you forgot use strict
in current scope. have warned you: bareword "g_array" not allowed
.
if g_array
function, \g_array
parses \(g_array())
. if isn't, parses \"g_array"
. passing reference string.
what wanted pass arrayref? include @
sigil in variable:
function2(\@g_array, "string");
Comments
Post a Comment