why are you sending
me copies of all email in and out of [EMAIL PROTECTED]?
here you can have
them back
NAME beginners-faq - FAQ for the beginners 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]> This is a high traffic list (100+ messages per day), so please subscribe in the way which is best for you. 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a week, and will be available online in the archives, and at http://learn.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 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 beginners. 1.11 - When was this FAQ last updated? July 11, 2001 2 - Questions about the 'beginners' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Monkeys * Monkeys solicitating homework on non-Perl related SPAM. 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, then it is allowed. You can ask CGI, networking, syntax, style, etc... types of questions. If your question has nothing at all to do with Perl, it will likely be ignored. If it has anything to do with Perl, it will likely be answered. 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 :) Please do not quote the documentation unless you have something to add to it. It is better to direct someone to the documentation so they hopefully will read documentation above and beyond that which answers their question. It also helps teach them how to use the documentation. 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 2.8 Is this a high traffic list? YES! You have been warned! If you don't want to get ~100 emails per day from this list, consider subscribing to the digest. 2.9 Other tips before posting to the list * Check the FAQs first * Don't send questions asking "... will this work?". Try it first, then report errors and ask the list why it *didn't* work. A good answer to "will this work?", is "What happened when you tried it?". * If your email begins with "I know this isn't the right place to ask this, but...", don't send it to this list :) If you know it doesn't belong, send it to where it does. * Check the FAQs first * Look at the archives, (http:[EMAIL PROTECTED]/) to see if your question has already been answered on the list. * Have meaningful Subjects. Subject lines like "Help!", and "This isn't working!" may be skipped by many people, and you may not get all the great help you want. Try to make your subject lines meaningful. For example, "sprintf() trouble", or "Confused about formats". 2.10 Can I ask the list for a code review? Sure. However, we request two things when doing so. First, that you put code somewhere on the web for people to look at it, instead of posting it to the list itself. Secondly, we request that people do not post their suggestions to the list, but rather the requester create a summary of suggestions and comments given, and post that to the list. This, in itself, could help other list members see things you did, and later changed due to suggestions. 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? Anything having to do with the names Matt Wright, or Selena Sol. Why? You may ask yourself. Well, their scripts are old and have been known to be buggy, as well as have security issues. They were written in the days of Perl 4. This means there is no scoping, stricture, warnings, idioms, or file locking to name a few issues. Because of this, it may be best to not steer a new Perl programmer to their code. It is easier to learn the correct way the first time, rather than have to relearn (or reteach) bad habits that are picked up. 3.3 - What books would be good? * Programming Perl, 3rd Ed. by Larry Wall, et al. (O'Reilly) * Learning Perl, 3rd Ed. by Randal Schwartz, et al. (O'Reilly) * Perl Cookbook, by Nat Torkington/Tom Christiansen (O'Reilly) * Mastering Regular Expressions, by Jeffrey Friedl (O'Reilly) * Effective Perl Programming, by Joseph N. Hall (Addison-Wesley) * Network Programming with Perl, by Lincoln Stein (Addison-Wesley) * Writing CGI Applications with Perl, by Kevin Meltzer/Brent Michalski (Addison-Wesley) * Object Oriented Perl, by Damian Conway (Manning) * Elements of Perl Programming, by Andrew Johnson (Manning) * Data Munging with Perl, by Dave Cross (Manning) * Teach Yourself Perl in 24 Hours, by Clinton Pierce (Sams) * Beginning Perl, by Simon Cozens (Wrox) 3.4 I use IRC, any helpful Perl channels out there? Glad you asked! There is indeed a place where you can ask all your Perl questions on IRC. Network: irc.rhizomatic.net Channel: #perl-help 4 - Think Before Posting! Please always think before you write; when you write you are taking the time of over a thousand people. If what you write takes just 30 seconds to read, that's more than 8 hours(!) of time burned that could have been used writing code. :) So please keep the following things in mind when posting: * Before you write a question please make sure you've checked all the FAQs and the documentation you know of. * Before you write an answer, make sure you that you really are contributing to a solution and doublecheck that noone else already gave the same answer. * If your question is about LWP (accessing webpages from Perl), DBI (accessing databases from Perl) or CGI (you know what that is :-) ) there are other mailinglists you should use. Subscribe by sending mail to: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] They all have digest versions too. You can subscribe to those by inserting -digest just before -subscribe, for example [EMAIL PROTECTED] * If you think what you are writing may be taken in a way you didn't intend, please add a smiley :-) Many flame wars are stopped by a simple smiley! * No flames. If your fingers are burning as you are typing the email, it would likely be best not to send it. __END__ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 09, 2001 10:33 AM > To: [EMAIL PROTECTED] > Subject: compilation error - simple program > > > I am just now learning perl. I have written a program that > ought to simply read a file a write its contents to another > file. However, I get the following message: > > "Syntax error at perl.txt line 8, near "$x". > Execution of perl.txt aborted due to compilation errors." > > Here is the code: > > #!/usr/bin/perl Get into the habit of using -w switch and 'use strict;' in all your programs. > open(INFILE, "testin"); > open(OUTFILE, ">testout"); What if the open()'s fail? You aren't checking for that. > > $x=getc(INFILE); > while($x!=eof(INFILE){ In addition to missing a right paren, this test is bizarre and unnecessary. You really just want: while(defined $x) { > print ("$x"); The double quotes around $x are unecessary and should be removed. Also, This prints to currently selected filehandle, which is STDOUT, not to OUTFILE. You either need to use: select OUTFILE; after you open OUTFILE, or print OUTFILE $x; > $x=getc(INFILE); > } > close(INFILE); > close(OUTFILE); You can simplify the loop as: while(defined($x = getc(INFILE))) { print OUTFILE $x; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
> -----Original Message----- > From: Frank Newland [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 09, 2001 12:35 PM > To: [EMAIL PROTECTED] > Subject: Perl equivalent to awk's 'getline' > > > Readers: > awk has a function called 'getline' which reads the next > line of input > without changing control of the script. > > My input file contains pairs of records. When I find a record > that matches > my search pattern, I want that record and the next record. > In awk, I used the 'getline' which did just that. > > How can I do this in perl? > Does using the $* variable get me there? > -------------------------------------------------- > #!/usr/bin/perl -w > use strict ; > ## If the record ends in 03 then capture this record and the next one. > while (<>) { > chomp ; > > if ( /03$/) { > print ; #print this record, now how do I capture just the next record? > } In addition to the responses you've already received, you can also look at the a2p utility that comes with perl. It translates awk scripts into perl scripts. It translates awk's getline into: if ($getline_ok = (($_ = <>) ne '')) { chomp; # strip record separator } Which seems overly cumbersome to me. I would think using chomp($_ = <>); would be just as good. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hi, I am using Telnet.pm module where I telnet to a router successfully. Now, I would like to send some control characters like "ctrl]". Is there a way to send octal or hex values in perl Thanks Atul -- 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]