OT: Perl syntax Question
Joseph Kubik
josephkubik-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Oct 24 16:36:10 UTC 2005
Thanks guys, that helps a lot.
-Joseph-
On 10/24/05, John Macdonald <john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org> wrote:
>
> On Mon, Oct 24, 2005 at 11:03:19AM -0400, Lennart Sorensen wrote:
> > On Mon, Oct 24, 2005 at 10:52:13AM -0400, Joseph Kubik wrote:
> > > What does the following mean?
> > >
> > > ($#{$reg->{'sale'}{'items'}} == -1)
> > >
> > > As, in, What does $#{} really do?
> >
> > $# = $OFMT, which is some weird deprecated perl thing that shouldn't be
> > used anymore, because printf is a much more sane way to do things.
> >
> > Or so says the camel book.
>
> Unfortunately, the expression {$reg...-1} following $#
> means that this is not the scalar variable named $# whose
> description you quote that is being used.
>
> Just as the statement:
>
> $x{'a'} = $x;
>
> refers to the array @x on the left side and the totally distinct
> scalar variable $x on the right side. (Well, a guru could
> quibble about the word totally, but for the purposes of this
> discussion, it is accurate enough.)
>
> The other replies, gaving the meaning as the index
> of the last element of the array whose reference is in
> $reg->{'sale'}{'items'} (or -1 if there are no elements in
> that array) were correct.
>
> --
> --
> The Toronto Linux Users Group. Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20051024/b366d73d/attachment.html>
More information about the Legacy
mailing list