Hi,

On Fri, 04 Jan 2002 Jeff 'japhy' Pinyan spewed into the ether:
> On Jan 4, Prahlad Vaidyanathan said:
> 
> >I tried this :
> >
> >my $text = "       this is a test" ;
> >
> ># Test 1
> >my $leading_spaces = ($text =~ m/^(\s+)/) ; # This doesn't work
> >print $leading_spaces ;                     # Prints 1
> 
> You have executed the regex in scalar context.  Why?  Because the

Does this mean the return value of the match is put into $leading_spaces
?

> left-hand side of the = is a single value.  You can make this into a
> one-element list by using parentheses:
> 
>   my ($leading_spaces) = $text =~ /^(\s+)/;

Thanks. That worked. But, I still don't understand what "list" in this
context means. And, what does "one-element list" mean ?

pv.
-- 
Prahlad Vaidyanathan <[EMAIL PROTECTED]>

Your object is to save the world, while still leading a pleasant life.

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

Reply via email to