[25901] in Perl-Users-Digest
Perl-Users Digest, Issue: 8129 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 30 09:05:17 2005
Date: Mon, 30 May 2005 06:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 30 May 2005 Volume: 10 Number: 8129
Today's topics:
Re: a simple question <raghavendra.ma@in.bosch.com>
Re: a simple question <georgekinley@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 30 May 2005 16:31:04 +0530
From: "Raghavendra Mahuli" <raghavendra.ma@in.bosch.com>
Subject: Re: a simple question
Message-Id: <d7erpm$1cc$1@ns2.fe.internet.bosch.com>
Thanx for all the responses....
"Brian McCauley" <nobull@mail.com> wrote in message
news:d7enr0$ml8$1@slavica.ukpost.com...
>
>
> Raghavendra Mahuli wrote:
>
> > Subject: a simple question
>
> Please put the subect of your post in the Subject of your post.
> > Hi all,
> > I have a simple question in perl... I have an array -
> >
> > @a = (10,20,30,40);
> >
> > Since '$' gives the scalar of a array ,
>
> No it doesn't. I'm not sure what you mean. Do you mean $a is the same
> as scalar(@a) ? No, that's not true.
>
> > i expect "print $a" to give the no.
> > of elements in the array...
>
> No, @a and $a are two completely separate variables.
>
> I have to confess this is rather messy in Perl5 - apparently it'll all
> be different in Perl6.
>
> In Perl5 @a is the array called 'a' and $a is a separate scalar variable
> also called 'a'. Confusingly $a[0] is the first element of @a and has
> nothing to do with $a. $#a is the last subscript of @a.
>
> This is all explained in some detail in the perldata manual.
------------------------------
Date: Mon, 30 May 2005 11:37:23 GMT
From: "George" <georgekinley@hotmail.com>
Subject: Re: a simple question
Message-Id: <xn0e2v7zu5ob2u1000@news.europe.nokia.com>
Raghavendra Mahuli wrote:
> Hi all,
> I have a simple question in perl... I have an array -
>
> @a = (10,20,30,40);
>
> Since '$' gives the scalar of a array , i expect "print $a" to give
> the no. of elements in the array...
> But it dosent work.. However if i copy it to a scalar and then print
> it, it works.. Can u pls explain why it is so?
> Here is the program listing:
>
> @a = (10,20,30,40);
> $x= @a;
> print $a;
> print $x;
>
> thanx in advance,
> regards,
> raghu
In perl your best friend is
use strict;
use warnings;
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8129
***************************************