Perl
Can anyone please help me with a short example Perl script that will print out all the odd numbers between 1 and 10? I don't know Perl and am trying to learn it. I wrote a bash script to do the same thing and wanted to compare it.
There must be a Perl expert out there somewhere who can help me?
Thanks-
Scott
BEGIN:VCARD
VERSION:2.1
N:Smallsreed;Scott
FN:Scott Smallsreed
TEL;HOME;VOICE:775-849-8411
TEL;HOME;FAX:775-849-8412
ADR;HOME:;;3030 Chipmunk Dr.;Washoe Valley;Nevada;89704;US LABEL;HOME;ENCODING=QUOTED-PRINTABLE:3030 Chipmunk Dr.=0D=0AWashoe Valley, Nevada 89704=0D=0AUS EMAIL;PREF;INTERNET:[email protected]
REV:20040401T055438Z
END:VCARD
www.google.com/linux
and then a search for perl... or books! did you know they have books with just this sort of thing in them! save your eyes, read a book my friend.
Quoted 10 lines · On Wed, 31 Mar 2004, Scott@Charter wrote:
Can anyone please help me with a short example Perl script that will print out all the odd numbers between 1 and 10? I don't know Perl and am trying to learn it. I wrote a bash script to do the same thing and wanted to compare it.
There must be a Perl expert out there somewhere who can help me?
Thanks-
Scott
Then why do these groups exist? Did you ever stop and think that maybe I am in a rush? Did you ever stop and think that maybe I am unemployed, looking for a job, and can't afford a book? Did you ever stop and think that there are kind, intelligent people out there who are willing and happy to just answer questions politely that are asked politely? I guess we can't all have your flare for life!
Go spread your cheer in the grumpy user group. (and I'm being nice) There are nice people out there who are willing to help me out. Some people just want/need a little help with certain things. Why did you become a member of this group?
Besides, I have a useless Perl book.
----- Original Message -----
From: "tyler" <[email protected]>
To: "Scott@Charter" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Wednesday, March 31, 2004 9:29 PM
Subject: Re: Perl
Quoted 9 lines
www.google.com/linux
and then a search for perl... or books! did you know they have books with just this sort of thing in them! save your eyes, read a book my friend.
Quoted 1 line · On Wed, 31 Mar 2004, Scott@Charter wrote:
Can anyone please help me with a short example Perl script that will
Quoted 1 line
Quoted 1 line
out all the odd numbers between 1 and 10? I don't know Perl and am
trying
Quoted 8 lines
Quoted 8 lines
to learn it. I wrote a bash script to do the same thing and wanted to compare it.
There must be a Perl expert out there somewhere who can help me?
Thanks-
Scott
Scott,
The issue is that you have sent about a dozen messages, which show little effort on your part to try and figure out these basic problems. Quite frankly, if you are unable to do these, which you say is a screening portion of an interview, that how do you expect to show any compentance within the realm if you get past that part. For a large part (and I don't speak for the entire list) everyone is willing to pitch in, if we can see that a reasonable effort has been shown, or if someone has a non-trivial problem. I still stand by what I said earlier, you are trying to get us to do your work for you. The web has a wealth of introductory material for all sorts of stuff. Get your feet wet. If you can't afford a book, go to the library, or search the web for reference material.
This list is an admin list, not a learn to program bash or perl group. It isn't that we don't want to help. But help yourself first. You won't get a job if you don't know basic fundamentals.
That said, for printing odd numbers 1-10. you can do it either of a few ways. One is simply to start at one and increment by 2 which will give you odd numbers all the way. Or if you want to be different, increment by one, and use % operator to find numbers that aren't divisible by 2.
#!/usr/bin/perl
for ($i=1; $i < 10 ; $i++)
{
if ($i%2 !=0)
{
print "$i\n";
}}
for ($i=1 ; $i < 10 ; $i+=2)
{
print "$i\n";
}
Good luck on the job hunt.
Quoted 48 lines · On Wed, 31 Mar 2004 22:54:22 -0800, Scott@Charter…
Then why do these groups exist? Did you ever stop and think that maybe I am in a rush? Did you ever stop and think that maybe I am unemployed, looking for a job, and can't afford a book? Did you ever stop and think that there are kind, intelligent people out there who are willing and happy to just answer questions politely that are asked politely? I guess we can't all have your flare for life!
Go spread your cheer in the grumpy user group. (and I'm being nice) There are nice people out there who are willing to help me out. Some people just want/need a little help with certain things. Why did you become a member of this group?
Besides, I have a useless Perl book.
----- Original Message -----
From: "tyler" <[email protected]>
To: "Scott@Charter" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Wednesday, March 31, 2004 9:29 PM
Subject: Re: PerlQuoted 9 lines
www.google.com/linux
and then a search for perl... or books! did you know they have books with just this sort of thing in them! save your eyes, read a book my friend.
Quoted 1 line · On Wed, 31 Mar 2004, Scott@Charter wrote:
Can anyone please help me with a short example Perl script that will
Quoted 1 line
Quoted 1 line
out all the odd numbers between 1 and 10? I don't know Perl and am
trying
Quoted 8 lines
Quoted 8 lines
to learn it. I wrote a bash script to do the same thing and wanted to compare it.
There must be a Perl expert out there somewhere who can help me?
Thanks-
Scott-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
| Richard Nairn Specializing in Linux | Nairn Consulting Web / Database Solutions | Calgary, AB | [email protected]
Dude,
Relax. To get good info out of lists come prepared with good questions. Especially be prepared for "RTFM".
This list is sparse. But, the best lists I belong to will give you the same "grumpy"
response if your questions are posted like this one.
Don't mean to be cheerless.
Quoted 49 lines · On Wed, 31 Mar 2004, Scott@Charter wrote:
Then why do these groups exist? Did you ever stop and think that maybe I am in a rush? Did you ever stop and think that maybe I am unemployed, looking for a job, and can't afford a book? Did you ever stop and think that there are kind, intelligent people out there who are willing and happy to just answer questions politely that are asked politely? I guess we can't all have your flare for life!
Go spread your cheer in the grumpy user group. (and I'm being nice) There are nice people out there who are willing to help me out. Some people just want/need a little help with certain things. Why did you become a member of this group?
Besides, I have a useless Perl book.
----- Original Message -----
From: "tyler" <[email protected]>
To: "Scott@Charter" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Wednesday, March 31, 2004 9:29 PM
Subject: Re: PerlQuoted 9 lines
www.google.com/linux
and then a search for perl... or books! did you know they have books with just this sort of thing in them! save your eyes, read a book my friend.
Quoted 1 line · On Wed, 31 Mar 2004, Scott@Charter wrote:
Can anyone please help me with a short example Perl script that will
Quoted 1 line
Quoted 1 line
out all the odd numbers between 1 and 10? I don't know Perl and am
trying
Quoted 8 lines
Quoted 8 lines
to learn it. I wrote a bash script to do the same thing and wanted to compare it.
There must be a Perl expert out there somewhere who can help me?
Thanks-
Scott-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Dan Kubilos __\o_ ^ K-8 Tech Coord http://www.oxnardsd.org
Email lists do not exist to do all the work for you. You tend to get the best results in situations where it is "I am trying to do such and such and such. This is the config I am using and this is the error I am getting. I searched google for an answer, but the solution I found didn't help. any ideas?"
People are not here to do the work. They are here to offer advice and a push in the right to direction to help get past sticking points.
As for saying "you're in a rush", that is probably the WORST thing you can say on these lists. Just about everyone on here is at work and doing their own job. It is rude and tacky to assume your problems are so important that you can't do initial research yourself, but we can take time out of our day to help you because you are lazy.
As for the "afford a book excuse", it has no bearing. When it comes to programming, there is SO much documentation and examples online, that the only reason to buy a book is to have an ordered hard copy reference material.
Just keep in mind that the "intelligent and friendly people" that are on lists, are typically at work and very busy themselves. No one is obligated to answer your questions and you will see the well run dry if you continue to expect others to do your work.
----- Original Message -----
From: "Scott@Charter" <[email protected]>
To: "tyler" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Thursday, April 01, 2004 1:54 AM
Subject: Re: Perl
Quoted 1 line
Then why do these groups exist? Did you ever stop and think that maybe I
am
Quoted 1 line
in a rush? Did you ever stop and think that maybe I am unemployed,
looking
Quoted 1 line
for a job, and can't afford a book? Did you ever stop and think that
there
Quoted 6 lines
are kind, intelligent people out there who are willing and happy to just answer questions politely that are asked politely? I guess we can't all have your flare for life!
Go spread your cheer in the grumpy user group. (and I'm being nice) There are nice people out there who are willing to help me out. Some people
just
Quoted 1 line
want/need a little help with certain things. Why did you become a member
of
Quoted 3 lines
this group?
Besides, I have a useless Perl book.
You would be better off in IRC for quick questions. These mailing lists go to a lot of people, so lots of small beginner questions that aren't exactly on topic (this isn't a PERL list) will just annoy people. In IRC you will likely get a faster response, and thousands of people will be spared the 20+ emails that have been generated from your discussion so far.
I would recommend EFNet or Freenode, as I've found lots of helpful folks on those networks.
~Brad
Quoted 55 lines · Scott@Charter wrote:
Then why do these groups exist? Did you ever stop and think that maybe I am in a rush? Did you ever stop and think that maybe I am unemployed, looking for a job, and can't afford a book? Did you ever stop and think that there are kind, intelligent people out there who are willing and happy to just answer questions politely that are asked politely? I guess we can't all have your flare for life!
Go spread your cheer in the grumpy user group. (and I'm being nice) There are nice people out there who are willing to help me out. Some people just want/need a little help with certain things. Why did you become a member of this group?
Besides, I have a useless Perl book.
----- Original Message -----
From: "tyler" <[email protected]>
To: "Scott@Charter" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Wednesday, March 31, 2004 9:29 PM
Subject: Re: PerlQuoted 9 lines
www.google.com/linux
and then a search for perl... or books! did you know they have books with just this sort of thing in them! save your eyes, read a book my friend.
Quoted 1 line · On Wed, 31 Mar 2004, Scott@Charter wrote:
Can anyone please help me with a short example Perl script that will
Quoted 1 line
Quoted 1 line
out all the odd numbers between 1 and 10? I don't know Perl and am
trying
Quoted 8 lines
Quoted 8 lines
to learn it. I wrote a bash script to do the same thing and wanted to compare it.
There must be a Perl expert out there somewhere who can help me?
Thanks-
Scott-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Scott :(
Seems you misundertand what these lists are for. These lists are for people to help people who are helping theirselves, and for people who are helping themselves receive help from people who want to help people helping themselves.
There are two things you are going to see when you post something like the thread you just did, and to varying degrees:
1.) RTFM
2.) STFW
You've already received suggestions like that so I won't bother engaging in a redundant act.
Now, If you're looking for a job as a Perl programmer and the book you have isn't doing it for you (and you don't have the money to buy another one), you prolly shouldn't be looking for a job programming in Perl.
Also, Oreilly has books online for you, some they charge for but the perl book is free if you look for it. You can even print a hard copy if you have enough paper.
Next time, instead of asking someone to "Do it for you", why don't you try posting your broken code here (or on a list that is more on topic), pointing out to the rest of us where you think the program is bombing?
You should also prolly d/l OpenPerlIDE at sourceforge, if you're running a wynd0z3 workstation, it's got a lot of help.
Finally, since you site a lack of money, there are lots of self help tutorials out there for Perl as well - but if you still want someone to "Do it for you", instead of "Help you", then I'm your man. Simply lemme know your fax number and I'll shoot you on over my Technical Services Agreement, then you sign and fax back. Then I'll write the application for you :) There's a one hour minimum, of course, so you will be billed for one hour at $85.00/hr.
"Scott@Charter" <[email protected]> wrote in message news:017601c417b6$2a379930$020aa8c0@Scott...
Quoted 1 line
Then why do these groups exist? Did you ever stop and think that maybe I
am
Quoted 1 line
in a rush? Did you ever stop and think that maybe I am unemployed,
looking
Quoted 1 line
for a job, and can't afford a book? Did you ever stop and think that
there
Quoted 6 lines
are kind, intelligent people out there who are willing and happy to just answer questions politely that are asked politely? I guess we can't all have your flare for life!
Go spread your cheer in the grumpy user group. (and I'm being nice) There are nice people out there who are willing to help me out. Some people
just
Quoted 1 line
want/need a little help with certain things. Why did you become a member
of
Quoted 4 lines
this group?
Besides, I have a useless Perl book.
Well it seems that our friend (NOT), [email protected] is a certifiable bonehead. I just received a response from him with some pretty colorful language - dayglow, I would say ;)
Scott, I'm not going to dignify your filthy comments by responding to that email, but your original post, which was is only five days old, certainly doesn't show the level of your animosity that you shared with me privately.
If that O'Reilly book is too much for you then perhaps this isn't the thing for you after all. It's an RTFM world out there, and you'll only last one or two days on the job anyway if you can't swim in that pond.
Since you feel such anger against everyone on these lists, then perhaps it is best if you just stick to your job as a plumber ;)
One more thing - if you didn't care, then why did you send such a long private flame? ;)
TTFN.
"Bradley D. Thornton" <[email protected]> wrote in message news:[email protected]...
Quoted 3 lines
Hi Scott :(
Seems you misundertand what these lists are for. These lists are for
people
Quoted 4 lines
to help people who are helping theirselves, and for people who are helping themselves receive help from people who want to help people helping themselves.
Quoted 8 lines
There are two things you are going to see when you post something like the thread you just did, and to varying degrees:
1.) RTFM
2.) STFW
You've already received suggestions like that so I won't bother engaging
in
Quoted 3 lines
a redundant act.
Now, If you're looking for a job as a Perl programmer and the book you
have
Quoted 5 lines
isn't doing it for you (and you don't have the money to buy another one), you prolly shouldn't be looking for a job programming in Perl.
Also, Oreilly has books online for you, some they charge for but the perl book is free if you look for it. You can even print a hard copy if you
have
Quoted 4 lines
enough paper.
Next time, instead of asking someone to "Do it for you", why don't you try posting your broken code here (or on a list that is more on topic),
pointing
Quoted 7 lines
out to the rest of us where you think the program is bombing?
You should also prolly d/l OpenPerlIDE at sourceforge, if you're running a wynd0z3 workstation, it's got a lot of help.
Finally, since you site a lack of money, there are lots of self help tutorials out there for Perl as well - but if you still want someone to
"Do
Quoted 2 lines
it for you", instead of "Help you", then I'm your man. Simply lemme know your fax number and I'll shoot you on over my Technical Services
Agreement,
Quoted 2 lines
then you sign and fax back. Then I'll write the application for you :) There's a one hour minimum, of course, so you will be billed for one hour
at
Quoted 7 lines
$85.00/hr.
"Scott@Charter" <[email protected]> wrote in message news:017601c417b6$2a379930$020aa8c0@Scott...
Quoted 1 line
Then why do these groups exist? Did you ever stop and think that maybe
I
Quoted 10 lines
am
Quoted 1 line
in a rush? Did you ever stop and think that maybe I am unemployed,
looking
Quoted 1 line
for a job, and can't afford a book? Did you ever stop and think that
there
Quoted 5 lines
are kind, intelligent people out there who are willing and happy to just answer questions politely that are asked politely? I guess we can't all have your flare for life!
Go spread your cheer in the grumpy user group. (and I'm being nice)
There
Quoted 3 lines
Quoted 1 line
are nice people out there who are willing to help me out. Some people
just
Quoted 1 line
want/need a little help with certain things. Why did you become a
member
Quoted 13 lines
of
Quoted 4 lines
this group?
Besides, I have a useless Perl book.
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Dear list,
dear Scott,
just to make life easier:
http://www.catb.org/~esr/faqs/smart-questions.html
This link is completly enough for mails of the type Scott wrote. Eric and Rick did a very good job in telling people how to ask good questions.
Scott: Hopefully you read it and learn from it.
Have a nice day,
Nico
Signature · 3 lines
Keep it simple & stupid, use what's available. pgp: 8D0E E27A | Nico Schottelius http://nerd-hosting.net | http://linux.schottelius.org
Nico,
Yes, there are people who know how to explain things properly, and with class. To those of you who noticed I discontinued asking questions several days ago. To be blind sided, and flamed, like the other guy did, several days after the question was asked, was completely inappropriate.
I've never seen Bradley Thornton actually ever answer questions but only flame me. I think that's all he's good for. Then he hides behind a news group.
Thanks Nico!
-Scott
----- Original Message -----
From: "Nico Schottelius" <[email protected]>
To: "Scott@Charter" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Sunday, April 04, 2004 11:10 PM
Subject: Re: Perl
I love the smell of napalm in the morning...
----- Original Message -----
From: "Scotts Charter" <[email protected]>
To: "Nico Schottelius" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Monday, April 05, 2004 2:39 AM
Subject: Re: Perl
Quoted 4 lines
Nico,
Yes, there are people who know how to explain things properly, and with class. To those of you who noticed I discontinued asking questions
several
Quoted 23 lines
days ago. To be blind sided, and flamed, like the other guy did, several days after the question was asked, was completely inappropriate.
I've never seen Bradley Thornton actually ever answer questions but only flame me. I think that's all he's good for. Then he hides behind a news group.
Thanks Nico!
-Scott
----- Original Message -----
From: "Nico Schottelius" <[email protected]>
To: "Scott@Charter" <[email protected]>
Cc: "Linux-Admin-Group" <[email protected]>
Sent: Sunday, April 04, 2004 11:10 PM
Subject: Re: Perl-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Scott@Charter wrote:
Can anyone please help me with a short example Perl script that will print out all the odd numbers between 1 and 10? I don't know Perl and am trying to learn it. I wrote a bash script to do the same thing and wanted to compare it.
There must be a Perl expert out there somewhere who can help me?
Thanks-
Scott
foreach ( 1 .. 10 ) {
print "$_ " if ($_ % 2 == 1);
}
".." is an operator that will return a list that is the range between left and right. foreach will run the code block for each item of the list, setting $_ to that item. print ... if does like it sounds, and % is the modulo operator, in other words, it returns the remainder if the % had been a /.
I hope this helps you, and I apologize for the unkind responses you have received from the list here.
If you have any perl questions, you may try http://www.perlmonks.org
Signature · 2 lines
Matt Howard <[email protected]> Superior Insurance - Technical Services