On Feb 8, John said:

>On Feb 7, Jeff 'japhy' Pinyan said:
>
>>  ($func, $fname, @args) = (
>>    "UCM::ucmPiperNewsDB",
>>    \&UCM::ucmPiperNewsDB,
>>    $file, uc("INTERNET_$env"), $script,
>>  );
>>
>>  print "Simulating $func(@args)\n";

Ick.  My brain switched $func and $fname.  It would make more sense for
$fname to be "UCM::ucmPiperNewsDB" and for $func to be the reference, but
oh well.

>I was trying to avoid the multiple variables, and specifically having 
>to change two strings/variables where there is really only one value 
>(since this might end up being a big if (why no switch/case?) so 
>I will cut and pasto.  This solution does work.
>
>>  $fname->( @args );
>
>Will the subroutine be called as if I had used &subroutine?  I don't 
>see how it could since I am passing parameters, but I don't want 
>to execute it that way (without it's own parameter stack) so I want 
>to be sure.  I read about this in perldoc perlsub but couldn't find 
>this detail.  Also, if I did want it to be called as &subroutine 
>(not that I would), how would I specify this?

  &$fname(@args);

$fname is a REFERENCE to a function.  To call the function, you must
either do $fname->(...) or &$fname(...).

>When I use uc( "INTERNET_$env_NEWS" ), the result is "INTERNET_".
>I have to use "INERNET_${env}_NEWS".  Is that a bug or a feature,
>and if a feature, what is the feature?

The _ character is allowed in variables names.

  $abc_def = "x";
  $abc = "y";

  print "$abc_def, ${abc}_def";  # x, y_def

So it is indeed a feature.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to