> do I need them every time I declare a variable?

Nope.  The parens force "list context".  Without them is "scalar" context.

For example...

my @foo = qw(1 2 3 4 5);

my $x = @foo; # =5, the number of elements
my ($y) = @foo; # =1, the first element

Certain functions and operations will do different things based on the
context they are called in.  For example when setting a scalar to an array
(like above), the number of elements is returned... but when setting an
array to a list (like above) you get as many elements as you have variables.

Hope that helps.

Rob


-----Original Message-----
From: David Gilden [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 2:17 PM
To: fliptop; [EMAIL PROTECTED]
Subject: my( $string ) 


Quick question:
my( $string ) = "you ordered " . $q->param('quantity') . " foobars\n";


What with the '( )'  do I need them every time I declare a variable?

Thanks!


Dave
( kora musician / audiophile / web master @ cora connection /  Ft. Worth,
TX, USA)
==============================================
         Cora Connection: Your West African Music Source
              Resources, Recordings, Instruments & More!
                   <http://www.coraconnection.com/> 
==============================================

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

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

Reply via email to