On 11/27/07, ciwei2103 <[EMAIL PROTECTED]> wrote:

> # execute a command which may be on a local system or a remote system
> sub _lrdo {
>      my ($cmd,$exec,$rtn);
>      ($cmd) = (@_);
>      $exec = (_localsys()) ? $cmd : "$SRSH{$SYS} $SYS $cmd";
>      $rtn=_do($exec);
>      return "$rtn";
> }
>
> sub _haconfmakero {
>     _lrdo("$VB/haclus -value ReadOnly");
> }
>
>
> Q1:  is the parenthes () around
>   _lrdo ( .. )  optional when called?

Yes, almost certainly. You may always use parentheses around the
arguments to a function call, but they may be omitted if doing so
doesn't change the meaning of the code. (You don't mention a
prototype, but if there is a prototype defined for the subroutine, the
parentheses may be required.)

> Q2: why (_) around
>   ($cmd ) = ( @_) ,

The parentheses on the right aren't significant, but the ones on the
left are. The assignment's right side would be evaluated in a scalar
context without the left-side parentheses; with them, it's a list
context, and $cmd is set from the first element of the list.

> Q3: what ( ) archive in the line
>    my ($cmd,$exec,$rtn );

In that line, the parentheses hold the list of variables for my().
Without the parentheses, only the first variable would be declared
lexical.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to