vit has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
Could you please explain me (or point me to a right place in a tutorial) what is the meaning of ":" and "()" in
my ($global):shared;
from http://www.bytemycode.com/snippets/snippet/286/

Replies are listed 'Best First'.
Re: Question about ":"
by moritz (Cardinal) on Jan 03, 2011 at 17:21 UTC
Re: Question about ":"
by locked_user sundialsvc4 (Abbot) on Jan 04, 2011 at 02:33 UTC

    ... and the “()” is simply Perl’s required syntax for specifying more-than-one variable name in a my declaration.   (Don’t ask me why.)

      Because the manual says so :) and because you can write
      (my $stuff: bar, undef, $glo : bal, my $ra : men ) = @_; my ( $d, $a, $n, $d, $i, $e, $s ) : dandies = @_;
      it would be tedious to have to use (my($stuff):bar...

      Because you are specifying a list of variables, and () denotes a list.