Re: Confusion on @array vs $array[] vs $array
And, for increased flexibility (strict/warn OK) my @array = ( 10,20,30,40); my %array = @array; my %hash = (1,2,3,4); my @hash = %hash; print Array Element \$array[1] = $array[1]\n; print Hash Element \$hash{'1'} = $hash{'1'}\n; print Array Hash Element \$array{'10'} = $array{'10'}\n; print Hash Array Element \$hash[1] = $hash[1]\n; Enjoy! -Original Message- From: Lance Murray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 18, 2002 11:02 AM To: [EMAIL PROTECTED] Subject: Confusion on @array vs $array[] vs $array Hello: I have been fairly confused on the intermixing of array naming standards. If I understand correctly, the @array syntaxt is used to refer to the whole array, while $array[n] is refered to specific elements. In my thinking, it would have been less confusing to use @array[n] to address specific elements, but Perl complaines bitterly when warnings /or strict is enabled. Is the rational for the $array[] character for identifying @array elements due to the fact that the $ character has special meaning (denotes variable or element) within double quoted text, while the @ sign has no special meanign within double quotes. Anyway, perhaps one of you syntactical thought police could give me some insights to the rational. I find it very confusing that the $ and @ characters are supposed to be used interchangeably to denote arrays, particularyly when I'm trying to fathom the relation to other issues such as scalar or list context. As I recall, hashes arso use % and @ interchangeably. Thanks, Lance -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add new piece of html code in perl not success:internal server error
Post that part of your code so people can help you.
Re: Confusion on @array vs $array[] vs $array
Hope this doesn't further belabor the issue, but just to put my two cents in, Perl syntactic rules for prefixing $, @, % are very consistent, IMHO: You just need to keep in mind the types of the values/data types ultimately being expressed, and it should become clearer. $ always prefixes scalars or references, @ always prefixes lists, and % always prefixes associative arrays (a.k.a hashes). @array is a list $array[n] is a scalar/reference %hash is a hash $hash{'key'} is a scalar/reference @$ref dereferences a reference to an array, accessing the array In this case, print $ref; would give you a reference scalar, something like ARRAY(0x4E3FB1C); print @$ref; would output the actual array list. Also try @hash{keys %hash}, which returns a list of the hash's values. In all these cases, the prefixed sigils consistently describe the data type ultimately expressed, rather than the data type of the originating variable's data structure. Kevin -- Original Message -- From: Octavian Rasnita [EMAIL PROTECTED] Date: Wed, 18 Dec 2002 20:13:58 +0200 @var is an array $var is a scalar $var[0] is also a scalar even though is an array element. @var[0] is an array which contains more array elements, but in this case it contains just a single element. To create an array slice with more elements, you'll need something like @var[0 .. n] You need to always use $ for scalars and @ for arrays. Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] - Original Message - From: Lance Murray [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, December 18, 2002 7:02 PM Subject: Confusion on @array vs $array[] vs $array Hello: I have been fairly confused on the intermixing of array naming standards. If I understand correctly, the @array syntaxt is used to refer to the whole array, while $array[n] is refered to specific elements. In my thinking, it would have been less confusing to use @array [n] to address specific elements, but Perl complaines bitterly when warnings /or strict is enabled. Is the rational for the $array[] character for identifying @array elements due to the fact that the $ character has special meaning (denotes variable or element) within double quoted text, while the @ sign has no special meanign within double quotes. Anyway, perhaps one of you syntactical thought police could give me some insights to the rational. I find it very confusing that the $ and @ characters are supposed to be used interchangeably to denote arrays, particularyly when I'm trying to fathom the relation to other issues such as scalar or list context. As I recall, hashes arso use % and @ interchangeably. Thanks, Lance -- -- -- #!/usr/bin/perl print Lance Murray, Information and Communications Systems\n, # department The Church of Jesus Christ of Latter-Day Saints\n, # employer and religion (801) 240-6583, murraylk\@ldschurch.org\n\n, # work phone number and email \Better to do a little well than a lot poorly (Socrates)\\n; # philosophy @P=split//,.URRUU\c8R;@d=split//,\nrekcah xinU / lreP rehtona tsuJ;sub p{ @p{r$p,u$p}=(P,P);piper$p,u$p;++$p;($q*=2)+=$f=!fork;map {$P=$P[$f^or d ($p{$_})6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/ close$_}%p;wait until$?;map{/^r/$_}%p;$_=$d[$q];sleep rand(2)if/\S/;print -- -- -- This message may contain confidential information, and is intended only for the use of the individual(s) to whom it is addressed. == == == -- -- -- 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add new piece of html code in perl not success:internal server error
src=https://www.paypal.com/images/x-click-but6.gif; border=0 name=submit alt=Make payments with PayPal - it's fast, free and secure! /form so I put a line print src=https://www.paypal.com/images/x-click-but6.gif; border=0 name=submit alt=Make payments with PayPal - it's fast, free and secure! /form; it aparant show a piece of white in my IE6, so I put \ in front of every inside of print , like print src=\https://www.paypal.com/images/; then, my browser show internal sever error highly apprecaite any advancer's help Sincere Eric www.linuxspice.com linux/window pc for sale Post that part of your code so people can help you. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners-cgi mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to [EMAIL PROTECTED] You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners-cgi%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a month, and will be available online in the archives, and at http://beginners.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who owns this list? Who do I complain to? Casey West owns the beginners-cgi list. You can contact him at [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl/CGI beginners. 1.11 - When was this FAQ last updated? Sept 07, 2001 2 - Questions about the 'beginners-cgi' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. The topic of the list is, of course, CGI with Perl. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Non Perl/CGI questions or issues * Lemurs 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl/CGI , then it is allowed. If your question has nothing at all to do with Perl/CGI, it will likely be ignored. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: perldoc perldoc At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 3 - Other Resources 3.1 - What other websites may be useful to a beginner ? * Perl Home Page - http://www.perl.com * PerlMonks - http://www.perlmonks.org * Perldoc - http://www.perldoc.com * Perl Archives - http://www.perlarchives.com 3.2 - What resources may be harmful to a beginner? Beware of Perl4-like code-- You might find some script archives and unauthorized mirrors with old Perl4 versions of Selena Sol and Matt Wright scripts. Don't use those scripts. They are outdated and may even in some cases contain bugs or security problems since many may not have been updated in
RE: add new piece of html code in perl not success:internal serve r error
-Original Message- From: eric [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 4:04 AM To: [EMAIL PROTECTED] Subject: add new piece of html code in perl not success:internal server error Dear perl users: I want to copy a piece of html code to my site, src=https://www.paypal.com/images/x-click-but6.gif; border=0 name=submit alt=Make payments with PayPal - it's fast, free and secure! /form tthen it just show nothing( a piece of white) then I tried to put \ before every then it have errror, Internal Server ERror Internal Server Error means: go check your web server error log. That's where the real error message will be. Also, make sure your script compiles: $ perl -c yourscript.cgi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Confusion on @array vs $array[] vs $array
On Wed, 18 Dec 2002 at 13:49, kevin christopher opined: kc:Hope this doesn't further belabor the issue, but just to put my kc:two cents in, Perl syntactic rules for prefixing $, @, % are kc:very consistent, IMHO: You just need to keep in mind the types of kc:the values/data types ultimately being expressed, and it should kc:become clearer. $ always prefixes scalars or references, @ kc:always prefixes lists, and % always prefixes associative arrays kc:(a.k.a hashes). kc: kc:@array is a list kc:$array[n] is a scalar/reference kc:%hash is a hash kc:$hash{'key'} is a scalar/reference kc:@$ref dereferences a reference to an array, accessing the array In kc:this case, print $ref; would give you a reference scalar, kc:something like ARRAY(0x4E3FB1C); print @$ref; would output the kc:actual array list. kc: kc:Also try @hash{keys %hash}, which returns a list of the hash's kc:values. i hope everyone realizes that all this will be changed in perl 6. here's a snippet from a slideshow by damian conway from the summer 2001: Access through...Perl 5 Perl 6 Array variable $foo[$idx] @foo[$idx] Array slice@foo[@idxs] @foo[@idxs] Hash variable $foo{$key} %foo{$key} Hash slice @foo{@keys} %foo{@keys} Scalar variable$foo$foo Array reference$foo-[$idx]$foo.[$n] Hash reference $foo-{$key}$foo.{$key} Code reference $foo-(@args) $foo.(@args) the complete slideshow can be found here as a pdf document: http://dev.perl.org/perl6/talks/Perl6-Notes-200108.v2.pdf it was also reported in the p6p digest from august 5-11, 2001: http://www.perl.com/pub/a/2001/08/p6pdigest/20010811.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: add new piece of html code in perl not success:internal server error
$var = qq(img src=https://www.paypal.com/images/x-click-but6.gif; border=0 name=submit alt=Make payments with PayPal - it's fast, free and secure! /form); Or no qq, and then quotemeta($var); perldoc -f quotemeta Btw, you forgot img in the beginning :) -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EMAIL PROTECTED] From: eric [EMAIL PROTECTED] Reply-To: eric [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: add new piece of html code in perl not success:internal server error Date: Thu, 12 Dec 2002 02:04:22 -0700 Dear perl users: I want to copy a piece of html code to my site, src=https://www.paypal.com/images/x-click-but6.gif; border=0 name=submit alt=Make payments with PayPal - it's fast, free and secure! /form tthen it just show nothing( a piece of white) then I tried to put \ before every then it have errror, Internal Server ERror I know it is just this piece of new code make ghost. Please help Sincere Eric www.linuxspice.com linux/window pc for sale -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Chatten met je online vrienden via MSN Messenger. http://messenger.msn.nl/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perl 6 (was: Re: Confusion on @array vs $array[] vs $array)
[reply cc'd to list] On Thu, 19 Dec 2002 at 06:23, Rob Richardson opined: RR:What is the advantage of these changes? RR:When is Perl 6 due out? RR:Do those links you provided describe all the differences we will see in RR:Perl 6? i'm no authority on perl 6, so i can't answer any of your questions. to keep up with what's happening, your best bet is to subscribe to one of the perl 6 mailing lists. you may want to start here: http://www.perl.org/support/mailing_lists.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]