|
Prev: got time out in ftp
Next: string compare
From: A. Sinan Unur on 31 Aug 2005 07:43 John Bokma <john(a)castleamber.com> wrote in news:Xns96C2F158BB4CFcastleamber(a)130.133.1.4: > "A. Sinan Unur" <1usa(a)llenroc.ude.invalid> wrote: > >> You don't have warnings enabled. Have you read the posting guidelines >> for this group yet? > > I was just wondering, if postings that don't follow the posting > guidelines are just ignored, especially by the regulars *and* together > with the FAQ xx.yy (or maybe instead of) a message is posted: > > Subject: Why is your message not answered? > > With a link to posting guidelines > (and to the FAQ)? Even if we ignore messages, I am sure someone will reply. If, say the OP in this thread, had to choose between reading a separate "Why is your message not answered?" thread as opposed to those replies, I have a feeling they'll choose the response, and ignore the pointers. Sinan -- A. Sinan Unur <1usa(a)llenroc.ude.invalid> (reverse each component and remove .invalid for email address) comp.lang.perl.misc guidelines on the WWW: http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
From: Paul Lalli on 31 Aug 2005 10:50 Jerry Cloe wrote: > Having an array: > > @mylist=("apples", "oranges", "bananas"); > > And refering to a particular element, which syntax is correct? (or are both > correct)? > > print "Item 2 is $mylist[1]\n"; > or > print "Item 2 is @mylist[1]\n"; > > Both seem to work, and looking at other code, I see it done both ways. That "other" code is almost assuredly wrong. Please do see the responses by other posters. In the meantime, however, some more information: both $foo[1] and @foo[1] will most likely Do What You Want - When you're READING them only. If you are writing to the two values, you are imposing two different contexts on whatever you're evaluating. The FAQ that others have referred you to gives as an example reading the output of an external program through back-ticks. Here's a possibly more simple-to-understand example: my @sizes; my (@foo, @bar); @foo = (4..12); @bar = qw/a b c d e f g h i j/; $sizes[0] = @foo; # correct, sets $size[0] to size of @foo, which is 9 @sizes[1] = @bar; # OOPS! sets $size[1] to the *first element* of foo, # which is 'a'; The reason for this is that $size[0] is a scalar value, and so scalar context is imposed on the array @foo. An array in scalar context returns its size. @size[1], on the other hand, is a list containing a single value. Assigning to a list imposes list context. This line is equivalent to having done: my ($size) = @bar; rather than my $size = @bar; When you assign one list to another, the values are copied over directly. The first value on the right gets assigned to the first variable on the left, the second on the right to the second on the left, etc. The reason Perl warns you when you use @size[1] even in a read (when it would actually probably not hurt your code) is that getting into the habbit of writing @size[1] when you mean $size[1] will come back to bite you, when you attempt to use it in a write, as I did above. I hope you find this explanation helpful... Paul Lalli
From: John Bokma on 31 Aug 2005 14:23 "A. Sinan Unur" <1usa(a)llenroc.ude.invalid> wrote: > John Bokma <john(a)castleamber.com> wrote in > news:Xns96C2F158BB4CFcastleamber(a)130.133.1.4: > >> "A. Sinan Unur" <1usa(a)llenroc.ude.invalid> wrote: >> >>> You don't have warnings enabled. Have you read the posting guidelines >>> for this group yet? >> >> I was just wondering, if postings that don't follow the posting >> guidelines are just ignored, especially by the regulars *and* together >> with the FAQ xx.yy (or maybe instead of) a message is posted: >> >> Subject: Why is your message not answered? >> >> With a link to posting guidelines >> (and to the FAQ)? > > Even if we ignore messages, I am sure someone will reply. Most replies are by regulars which write the same over and over again (use strict, etc.). I am sure most of them can be convinced to stop replying. > If, say the OP > in this thread, had to choose between reading a separate "Why is your > message not answered?" thread as opposed to those replies, I have a > feeling they'll choose the response, and ignore the pointers. Most even ignore the response as well, as you probably must have noticed on many occassions. If most regulars stop replying to posts that don't follow the posting guidelines, or are not about Perl, a lot of noise might be gone. I am going to try it :-D. -- John Small Perl scripts: http://johnbokma.com/perl/ Perl programmer available: http://castleamber.com/ Happy Customers: http://castleamber.com/testimonials.html
From: A. Sinan Unur on 31 Aug 2005 14:28 John Bokma <john(a)castleamber.com> wrote in news:Xns96C38803D3FB0castleamber(a)130.133.1.4: > If most regulars stop replying to posts that don't follow > the posting guidelines, or are not about Perl, a lot of > noise might be gone. I agree it is worth a shot. > I am going to try it :-D. I'll try to follow your lead. Sinan -- A. Sinan Unur <1usa(a)llenroc.ude.invalid> (reverse each component and remove .invalid for email address) comp.lang.perl.misc guidelines on the WWW: http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
From: John W. Krahn on 31 Aug 2005 22:13
A. Sinan Unur wrote: > John Bokma <john(a)castleamber.com> wrote in > news:Xns96C38803D3FB0castleamber(a)130.133.1.4: > >>If most regulars stop replying to posts that don't follow >>the posting guidelines, or are not about Perl, a lot of >>noise might be gone. > > I agree it is worth a shot. > >>I am going to try it :-D. > > I'll try to follow your lead. Ah, finally a leader we can all follow. ;-) John -- use Perl; program fulfillment |