"Uri Guttman" <u...@stemsystems.com> writes:

>   HP> The output from the script below:
>   HP> Shows 6 elements arrive in dispt($g, @ar) as @_.  But when sub N(@_)
>   HP> is called, no variables arrive there. @_ is empty. When it seems like
>   HP> 5 elements should have arrived there
>
> well, it helps if you actually pass in arguments. @_ is NOT a global.FF
>
>   HP>     my $code = $dispt{$selection} || $dispt{'error'} ;
>   HP>     $code->();
>
> you aren't passing anything in to $code. you need to put something in
> the () which then is set in the @_ of the called sub.

As usual, I'm a little confused here.  First, what is a `global.FF'?

And why would it matter that `...@_' is not global when its content was
placed into a sub function?

Inside dispt {...the sub function @_...} `...@_' is alive and well

  (I'm changing the name of the hash `%dispt' (inside sub dispt {...})to
  %hash, it was probably a poor choice of names)

-------        ---------       ---=---       ---------      -------- 
#!/blah/blah/perl

 ## out here in global country  `...@_' is unknown

 dispt($var,@ar);

 sub dispt { ...
   ## @_ is alive here containing $var,@ar.
  
   %hash = (  print N(@_ # `...@_' is dead here at the N(@_) call) 
  );  

 ...} 

which is also inside sub dispt {the sub function}.  Where does global
come in?


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to