Re: FW: Question about Beginning Perl by Simon Cozens

2016-09-01 Thread Neil Hainer
2016 12:47 PM > *To:* 'Aaron Wells' > *Subject:* RE: Question about Beginning Perl by Simon Cozens > > > > Thank you all for sharing your perspective on this. I will compare both > the first and second editions of *Beginning Perl*. Cozens’ writing style > really

Re: Question about Beginning Perl by Simon Cozens

2016-09-01 Thread Neil Hainer
tps://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840 > > This one is more relevant. I read it and it is very good. > > However, If you never programming before Learning Perl probably is better > to start with. > > > > On Thu, Sep 1, 2016 at 9:52 AM, Walker

FW: Question about Beginning Perl by Simon Cozens

2016-09-01 Thread Walker, Michael E
From: Walker, Michael E Sent: Thursday, September 01, 2016 12:47 PM To: 'Aaron Wells' Subject: RE: Question about Beginning Perl by Simon Cozens Thank you all for sharing your perspective on this. I will compare both the first and second editions of Beginning Perl. Cozens’ writing st

Re: Question about Beginning Perl by Simon Cozens

2016-09-01 Thread Илья Рассадин
Hi! For introduction to Modern Perl practicies, read Modern Perl by chromatic http://modernperlbooks.com/books/modern_perl_2016/index.html 01.09.16 19:52, Walker, Michael E пишет: Hi, even though _Beginning Perl_ dates back to 2000, is it still relevant for learning today? I wondered, becau

Re: Question about Beginning Perl by Simon Cozens

2016-09-01 Thread Hao Wu
https://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840 This one is more relevant. I read it and it is very good. However, If you never programming before Learning Perl probably is better to start with. On Thu, Sep 1, 2016 at 9:52 AM, Walker, Michael E < michael.e.walk...@boeing.

Question about Beginning Perl by Simon Cozens

2016-09-01 Thread Walker, Michael E
Hi, even though Beginning Perl dates back to 2000, is it still relevant for learning today? I wondered, because when Googling, I saw posts recommending against its use, but yet it is still listed at books.perl.org. Please discuss, or point me to the archive on this list where this has been

Re: Script to prepend text to beginning of file

2011-01-21 Thread Brian Fraser
> > use strict; > use warnings; > use Tie::File; > > my @array; > tie @array, 'Tie::File', FILENAME or die "Couldn't open file: $!" > > unshift @array, <<'END_PREPEND'; > ENTHDR|1|3.0 > STAGEHDR|Barcoded > END_PREPEND > Haven't tested it, but it should work. http://perldoc.perl.org/Tie/File.html

Re: Script to prepend text to beginning of file

2011-01-21 Thread Shlomi Fish
; 4. "use strict;" and "use warnings;". > > > > 5. Still uses the "-w" flag. > > The steve's mail, in this thread, said the following: > > "I need to add 2 lines to a file and add the following text. > > ENTHDR|1|3.0 > STAGEHDR|Ba

Re: Script to prepend text to beginning of file

2011-01-21 Thread Ary Kleinerman
Shlomi, On Fri, Jan 21, 2011 at 12:13 PM, Shlomi Fish wrote: > Hi Ary, > > On Friday 21 Jan 2011 16:01:36 Ary Kleinerman wrote: > > A simple way: > > > > #!/usr/bin/perl -w > > open FILE, ">>file.txt"; > > print FILE "line1\n"; > > print FILE "line2\n"; > > print FILE "ENTHDR|1|3.0\n"; > > print

Re: Script to prepend text to beginning of file

2011-01-21 Thread Shlomi Fish
Hi Ary, On Friday 21 Jan 2011 16:01:36 Ary Kleinerman wrote: > A simple way: > > #!/usr/bin/perl -w > open FILE, ">>file.txt"; > print FILE "line1\n"; > print FILE "line2\n"; > print FILE "ENTHDR|1|3.0\n"; > print FILE "STAGEHDR|Barcoded\n"; > close FILE; > This script will *append* 4 lines to

Re: Script to prepend text to beginning of file

2011-01-21 Thread Shlomi Fish
useful to think of a file as a big sequence of octets, where you can overwrite or append data if it's the same width, but you cannot insert stuff in the middle (or the beginning) or remove stuff from inside easily. The best way to prepend some data to the beginning is to write a new file

Re: Script to prepend text to beginning of file

2011-01-21 Thread Ary Kleinerman
A simple way: #!/usr/bin/perl -w open FILE, ">>file.txt"; print FILE "line1\n"; print FILE "line2\n"; print FILE "ENTHDR|1|3.0\n"; print FILE "STAGEHDR|Barcoded\n"; close FILE; On Thu, Jan 20, 2011 at 3:57 PM, steve1040 wrote: > I need to add 2 lines to a file and add the following text. > > E

Script to prepend text to beginning of file

2011-01-21 Thread steve1040
I need to add 2 lines to a file and add the following text. ENTHDR|1|3.0 STAGEHDR|Barcoded I don't have any idea how to do this in Perl Thanks Steve -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Stripping the beginning of a line of spaces

2008-10-11 Thread John W. Krahn
space from the beginning/end of a string" John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Stripping the beginning of a line of spaces

2008-10-11 Thread AndrewMcHorney
Hello Now the question how does this put this into a line of code? Say I have $String1 and $String2 where I want to do $String1 = $String2 with the conversion. What would the code look like? Andrew At 05:23 PM 10/11/2008, Mr. Shawn H. Corey wrote: On Sat, 2008-10-11 at 16:58 -0700, AndrewMc

Re: Stripping the beginning of a line of spaces

2008-10-11 Thread Mr. Shawn H. Corey
On Sat, 2008-10-11 at 16:58 -0700, AndrewMcHorney wrote: > Hello > > I am working on a script that does a directory of a Windows drive. > There are some lines returned where there are spaces before the 1st > character. This throws off the splitting of the line into an array. > How can I strip t

Stripping the beginning of a line of spaces

2008-10-11 Thread AndrewMcHorney
Hello I am working on a script that does a directory of a Windows drive. There are some lines returned where there are spaces before the 1st character. This throws off the splitting of the line into an array. How can I strip the leading characters in an efficient way into either the same stri

Re: Beginning to use the stricts and warnings

2007-04-09 Thread Chas Owens
On 4/9/07, Jean-Rene David <[EMAIL PROTECTED]> wrote: * Chas Owens [2007.04.09 11:00]: > > for (my $i = 0; $i < @banks; $i++) > > If you must loop this way at least do it like this: > > for my $i (0 .. $#banks) {} > > But most likely you don't need to loop that way and it is better to > loo

Re: Beginning to use the stricts and warnings

2007-04-09 Thread Jean-Rene David
* Chas Owens [2007.04.09 11:00]: > > for (my $i = 0; $i < @banks; $i++) > > If you must loop this way at least do it like this: > > for my $i (0 .. $#banks) {} > > But most likely you don't need to loop that way and it is better to > loop this way: > > for my $bank (@banks) {} I've been

Re: Beginning to use the stricts and warnings

2007-04-09 Thread Jeff Pang
Hello, 2007/4/9, Rodrigo Tavares <[EMAIL PROTECTED]>: Hello, I put in my code: if i put in code : my @ARGV = ('a'); Come the message: You shouldn't use 'my' to declare the @ARGV since @ARGV is a special package variable in Perl.Instead you can access this array directly,don't need the de

Re: Beginning to use the stricts and warnings

2007-04-09 Thread Chas Owens
On 4/9/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote: Hello, I put in my code: use strict; use warnings; So I declared many variables. By example counters and arrays. Using my. My script start the postgres. ./postgresql.pl start|stop|reload|status I'm using this below structure. When I run t

Beginning to use the stricts and warnings

2007-04-09 Thread Rodrigo Tavares
Hello, I put in my code: use strict; use warnings; So I declared many variables. By example counters and arrays. Using my. My script start the postgres. ./postgresql.pl start|stop|reload|status I'm using this below structure. When I run the script como the message : Use of uninitialized valu

Re: manipulate strings to strip the beginning part

2006-07-17 Thread Rob Dixon
print $tail, "\n"; # OR $tail = do { my @tail = split /\\/, $path; join '\\', @tail[2..$#tail]; }; print $tail, "\n"; - Do you want to remove stuff from the beginning of the path until a directory starting 'SiA'? This will do that for you

manipulate strings to strip the beginning part

2006-07-16 Thread Nishi Bhonsle
Hi: I want to manipulate strings containing filenames that have the following format Web\SiA\web\..\..\ etc Web\SiAData\web\app\..\..\ etc to remove everything in the begining of web part of the above strings and store the rest of the part ie web\..\..\ into a new string. Thereafter I will refere

Re: whitespace beginning and end

2006-02-22 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > Perlers Hello, > I need to remove any line that begins with \d+ yet end with \s* EVERY line ends with \s* so you want to remove every line? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

RE: whitespace beginning and end

2006-02-22 Thread DBSMITH
Do you mean like unless($_ =~ /^\s*\d+\s*$/){ print $_; } ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 22, 2006 2:36 PM To: beginners@perl.org Subject: whitespace beginning and end

RE: whitespace beginning and end

2006-02-22 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > Perlers > > I need to remove any line that begins with \d+ yet end with \s* > Here is the data > > _BEGIN_DATA_ > >0 2005/09/23 17:25 221 100% -il-o-b---U- sf F02043 > 72 2005/10/07 17:12 524 100% -il-o-b---U- sf H02053 > 73 2005/10/10 13:23

RE: whitespace beginning and end

2006-02-22 Thread Timothy Johnson
Do you mean like unless($_ =~ /^\s*\d+\s*$/){ print $_; } ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 22, 2006 2:36 PM To: beginners@perl.org Subject: whitespace beginning and end Perlers I

whitespace beginning and end

2006-02-22 Thread DBSMITH
Perlers I need to remove any line that begins with \d+ yet end with \s* Here is the data _BEGIN_DATA_ 0 2005/09/23 17:25 221 100% -il-o-b---U- sf F02043 1 2005/06/03 04:11 524 100% -il-o-b---U- sf F02017 2 2005/06/10 00:12 592 100% -il-o-b---U- sf F02018 3 20

RE: Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Jeff 'japhy' Pinyan
On Jun 2, Siegfried Heintze said: s/\bJr\b/ Junior /gi; This is not exactly what I want because it will put a space before "Junior" even if Junior is at the beginning and I don't want a space? Just do s/\bJr\b/Junior/gi; The \b is an anchor -- it matches a location,

RE: Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Siegfried Heintze
Thanks! Yes I want the \b. Now what about this: s/\bJr\b/ Junior /gi; This is not exactly what I want because it will put a space before "Junior" even if Junior is at the beginning and I don't want a space? I suppose I could do this: s/(\b)Jr(\b)/\1Junior\2/gi; Is ther

Re: Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Jeff 'japhy' Pinyan
On Jun 2, Siegfried Heintze said: How do I search for the word "intern" without searching for "internal"? What I have been doing is /intern[^a]/ but that won't match /intern$/. You want to use a negative look-ahead: /intern(?!al)/ That means "match 'intern' that is not followed by 'al'".

Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Siegfried Heintze
How do I search for the word "intern" without searching for "internal"? What I have been doing is /intern[^a]/ but that won't match /intern$/. Thanks, Siegfried

Re: Wild card substitution - Beginning of string to pattern, pattern to end of string.

2005-02-09 Thread Jeff 'japhy' Pinyan
On Feb 9, Tham, Philip said: $var1 =~ s/^*.4160 //.; $var1 =~ s/\smodules*.$//; Your primary problem is that you're using "*." when you mean ".*" -- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://japhy.

Re: Wild card substitution - Beginning of string to pattern, pattern to end of string.

2005-02-09 Thread John W. Krahn
Tham, Philip wrote: I have a variable $var1 containing a string with the text below I am trying to remove all the text before the work authors Whatever I am using does not seem to work $var1 =~ s/^*.4160 //.; $var1 =~ s/\smodules*.$//; 2005-02-08 online since 1995-10-26 2734 MB 271 mirrors 4160

RE: Wild card substitution - Beginning of string to pattern, pattern to end of string.

2005-02-09 Thread Charles K. Clarkson
From: Tham, Philip wrote: : I have a variable $var1 containing a string with the text below : : I am trying to remove all the text before the work authors : : Whatever I am using does not seem to work : : $var1 =~ s/^*.4160 //.; You need to add the /s modifier to

Wild card substitution - Beginning of string to pattern, pattern to end of string.

2005-02-09 Thread Tham, Philip
I sent this email earlier under the wrong subject - sending it again. -Original Message- From: Tham, Philip Sent: Wednesday, February 09, 2005 1:52 PM To: beginners@perl.org Subject: RE: Hopefully simple build question! I have a variable $var1 containing a string with the text below I

RE: pulling out "a","an", "the" from beginning of strings

2004-08-25 Thread Bob Showalter
John W. Krahn wrote: > Bob Showalter wrote: > > Jose Alves de Castro wrote: > > > > > On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > > > > > > > I need to pull out articles "a", "an", and "the" from the > > &g

RE: pulling out "a","an", "the" from beginning of strings

2004-08-25 Thread Bob Showalter
. > Also, what is the "\b"? A word boundary assertion. See perldoc perlre. > it seems > that the trailing "i" is for ignoring case; is that correct? Yes. It's not concerned with capturing anything; it's just matching a pattern and then replacing the

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Chris Devers
On Tue, 24 Aug 2004, Errin Larsen wrote: Perhaps: $scalar =~ s/^(a|an|the)\s*\b//i; would work better. <> Is this capturing into $1 the a|an|the (yes) and the rest of the title into $2 (no?). There is only one pair of parentheses, so only $1 is captured. I still think it's prudent to capture ev

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread John W. Krahn
Bob Showalter wrote: Jose Alves de Castro wrote: On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: I need to pull out articles "a", "an", and "the" from the beginning of title strings so that they sort properly in MySQL. What is the best way to accomplish that if I

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Errin Larsen
Hey, Ok, looking through this ... I'm confused. << SNIP >> > > > > Perhaps: > > > >$scalar =~ s/^(a|an|the)\s*\b//i; > > > > would work better. <> Is this capturing into $1 the a|an|the (yes) and the rest of the title into $2 (no?). After doing so, will it reverse the two ( i.e. s/^(a|a

RE: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Jose Alves de Castro
On Tue, 2004-08-24 at 16:19, Bob Showalter wrote: > Jose Alves de Castro wrote: > > On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > > > I need to pull out articles "a", "an", and "the" from the beginning > > > of title strings so that th

RE: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Bob Showalter
Jose Alves de Castro wrote: > On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > > I need to pull out articles "a", "an", and "the" from the beginning > > of title strings so that they sort properly in MySQL. What is the > > best way to accomplish

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Jose Alves de Castro
On Tue, 2004-08-24 at 15:39, Chris Devers wrote: > On Tue, 24 Aug 2004, Jose Alves de Castro wrote: > > > On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > >> I need to pull out articles "a", "an", and "the" from the beginning of > >>

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Chris Devers
On Tue, 24 Aug 2004, Jose Alves de Castro wrote: On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: I need to pull out articles "a", "an", and "the" from the beginning of title strings so that they sort properly in MySQL. What is the best way to accomplish that if I

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Tim McGeary
Jose Alves de Castro wrote: On Tue, 2004-08-24 at 15:16, Tim McGeary wrote: Jose Alves de Castro wrote: On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: I need to pull out articles "a", "an", and "the" from the beginning of title strings so that they sort properly i

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Jose Alves de Castro
On Tue, 2004-08-24 at 15:16, Tim McGeary wrote: > Jose Alves de Castro wrote: > > On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > > > >>I need to pull out articles "a", "an", and "the" from the beginning of > >>title strings so

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Tim McGeary
Jose Alves de Castro wrote: On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: I need to pull out articles "a", "an", and "the" from the beginning of title strings so that they sort properly in MySQL. What is the best way to accomplish that if I have a single $scalar

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Jose Alves de Castro
On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > I need to pull out articles "a", "an", and "the" from the beginning of > title strings so that they sort properly in MySQL. What is the best way > to accomplish that if I have a single $scalar with

Re: pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Jose Alves de Castro
On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > I need to pull out articles "a", "an", and "the" from the beginning of > title strings so that they sort properly in MySQL. What is the best way > to accomplish that if I have a single $scalar with

pulling out "a","an", "the" from beginning of strings

2004-08-24 Thread Tim McGeary
I need to pull out articles "a", "an", and "the" from the beginning of title strings so that they sort properly in MySQL. What is the best way to accomplish that if I have a single $scalar with the whole title in it? Thanks, Tim -- Tim McGeary [EMAIL PROTECT

Re: Here is the URL for Beginning Perl

2004-08-14 Thread hcohen2
Forgive me if this already made the list, but I have not seen a copy and I also received a message that the message failed to be delivered. Since, I had received a number of the latter and subsequently got replies I became jaded. Nonetheless, it appears my message has not made it. I am only

Re: Here is the URL for Beginning Perl

2004-08-13 Thread hcohen2
Chris Devers wrote: Go back to the original telnet line, establish a connection, and then type one word, followed by hitting the enter key twice. (Did you see how CGI scripts have to terminated headers with "\n\n" ? Hitting return twice is the same thing.) This should bring back a response from

Re: Here is the URL for Beginning Perl

2004-08-13 Thread hcohen2
Chris Devers wrote: Ok, that changes things. So then, this is Apache? Running on ...Linux? OSX? Windows? Other? Linux Mandrake 9.1 on an IBM laptop with multiple boot options (e.g. Windows 2000 a.k.a. NT 5). The first thing to do is figure out if your web server is up, running, listening, and

Re: Here is the URL for Beginning Perl

2004-08-13 Thread Chris Devers
On Fri, 13 Aug 2004, hcohen2 wrote: Chris Devers wrote: Ok, that changes things. So then, this is Apache? Running on ...Linux? OSX? Windows? Other? Linux Mandrake 9.1 Ok, knowing that that makes things easier. If you're on an operating system with a command line, try this (the lines you type wil

Re: Here is the URL for Beginning Perl

2004-08-13 Thread Chris Devers
On Fri, 13 Aug 2004, hcohen2 wrote: Chris Devers wrote: OK, my problem is that the attempt to connect using 127.0.0.1 gets a message something like connection refused by the server. Is there some location in the httpd.conf file to list an acceptable client? Is the web server running on your des

Re: Here is the URL for Beginning Perl

2004-08-13 Thread David Greenberg
> > > I am sure the server is running, but typing in the ip address keeps > getting me a connection refused message. Hence, I think somewhere I need > to make myself an acceptable client. > Can you ping 127.0.0.1 or access ftp through that IP. If so, it probably is an http configuration. If not,

Re: Here is the URL for Beginning Perl

2004-08-13 Thread hcohen2
Chris Devers wrote: OK, my problem is that the attempt to connect using 127.0.0.1 gets a message something like connection refused by the server. Is there some location in the httpd.conf file to list an acceptable client? Is the web server running on your desktop? Yes or no? Yes, it's on this

Re: Here is the URL for Beginning Perl

2004-08-13 Thread Chris Devers
Please send *all* replies to the list, not me directly. Thanks. On Fri, 13 Aug 2004, hcohen2 wrote: http://learn.perl.org/library/beginning_perl/ Oh, ok, I wasn't familiar with that one. OK, my problem is that the attempt to connect using 127.0.0.1 gets a message something like connection refused

Here is the URL for Beginning Perl

2004-08-13 Thread hcohen2
http://learn.perl.org/library/beginning_perl/ I have been taking the pdf's down and working my way through the book. What I do not like are the large number of mistakes, typos the sometimes make it difficult. Moreover, this is an old book circa 2000 with a new copy just now appearing. Persona

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-08 Thread Stuart White
--- James Edward Gray II <[EMAIL PROTECTED]> wrote: > On Mar 7, 2004, at 7:07 PM, Stuart White wrote: > > > Ah, so there is a use for the for which is like > > foreach other than a shortcut. Can I do that with > > foreach? I see that what you are describing with > the > > foreach loops above is

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-08 Thread James Edward Gray II
On Mar 7, 2004, at 7:07 PM, Stuart White wrote: Ah, so there is a use for the for which is like foreach other than a shortcut. Can I do that with foreach? I see that what you are describing with the foreach loops above is what was going on with my nested foreach loops before. I believe this is t

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-08 Thread John W. Krahn
"R. Joseph Newton" wrote: > > I just checked, and this is special magic with the __END__ and __DATA__ tags. > For instance: > > Greetings! E:\d_drive\perlStuff>perl -w > while () { >print; > } > > __JABBERWOCK__ > Hello > > Does not work, as we can see. If you want __JABBERWOCK__ to work

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-07 Thread WC -Sx- Jones
R. Joseph Newton wrote: Greetings! E:\d_drive\perlStuff>perl -w while () { print; } __JABBERWOCK__ Hello YOU can YOU can :) Just write an Inline for it: use Inline JABBERWOCK; goto_AlphaCenturi(); __END__ __JABBERWOCK__ void goto_AlphaCentur() { printf("I've been banished *to* Jab

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-07 Thread R. Joseph Newton
Stuart White wrote: > This was my first chance at testing this, and it did > work. How, I'm not sure though. > Specifically: > > What do you call the "PRIMES:" and "__END___" syntax? The two are not directly related. The way PRIMES is used here makes it a label. This allows rapid, uncomplicate

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-07 Thread Stuart White
--- James Edward Gray II <[EMAIL PROTECTED]> wrote: > Let's start with the easy one, __END__. There's no > magic going on > here, you're program will run fine without it. > Consider it a note to > perl that reads, "My code stops here, don't read > on." I add it to > programs I post into me

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-07 Thread Stuart White
--- James Edward Gray II <[EMAIL PROTECTED]> wrote: > Let's start with the easy one, __END__. There's no > magic going on > here, you're program will run fine without it. > Consider it a note to > perl that reads, "My code stops here, don't read > on." I add it to > programs I post into me

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-07 Thread James Edward Gray II
On Mar 7, 2004, at 8:55 AM, Stuart White wrote: This was my first chance at testing this, and it did work. How, I'm not sure though. Then, I'm glad you asked. Let's take a closer look. Specifically: What do you call the "PRIMES:" and "__END___" syntax? I'll look up what it's purpose is, I just

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-07 Thread Stuart White
This was my first chance at testing this, and it did work. How, I'm not sure though. Specifically: What do you call the "PRIMES:" and "__END___" syntax? I'll look up what it's purpose is, I just don't know it's name. Next, I don't quite understand the for loops. I understand that you created t

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-03 Thread James Edward Gray II
On Mar 2, 2004, at 9:10 PM, Stuart White wrote: Stuart, can we please see the whole script? Stuart, I reworked the for loops to do what I believe you intended and made a few other general cleanups. See if this gets you going: #!/usr/bin/perl # primeNumbers.pl use warnings; use strict; print "E

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-03 Thread R. Joseph Newton
evaluating further. This seems to be used less frequently than with the ||, though. Joseph > > stuart>I thought shift was to remove an element from > stuart>the beginning of an array, but it's being used > stuart>in scalar context here. Why? And what is it > stuart>d

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread James Edward Gray II
On Mar 2, 2004, at 5:38 PM, Stuart White wrote: --- James Edward Gray II <[EMAIL PROTECTED]> wrote: It makes perfect sense, yes, but I'm still missing one piece of information, the broken code you would like fixed. As I said in my last message, "...just post that nested foreach and let us help you

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread Stuart White
> > Stuart, can we please see the whole script? > #!/usr/bin/perl # primeNumbers.pl use warnings; use strict; my $input; my @list; my @primelist; my @newPrimeList; my $i; my $j; print "I want you to enter a list of numbers bigger than 2.\n"; print "To mark the end of your list, enter 0.\n"; pri

RE: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread Stuart White
gt; (3) A very simple implementation of an erogenous > sieve (iud? did I say > that wrong?) > which keeps all primes in '@primes' and all > 'eliminated' entries in > '%notprime'. > quick, but likely more memory intensive than > (2). This one is a

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread Stuart White
--- James Edward Gray II <[EMAIL PROTECTED]> wrote: > It makes perfect sense, yes, but I'm still missing > one piece of > information, the broken code you would like fixed. > As I said in my > last message, "...just post that nested foreach and > let us help you fix > it." My mistake, I tho

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread James Edward Gray II
On Mar 1, 2004, at 6:14 PM, Stuart White wrote: That's not really accurate. What was said to that: @list = "@list"; Creates a joined string of elements and replaces the list with that one item. It's perfectly reasonable to stringify an array, without altering the array's contents: print "@lis

RE: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread David le Blanc
> From: Stuart White [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 2 March 2004 11:55 PM > To: David le Blanc; [EMAIL PROTECTED] > Subject: RE: listing prime numbers in a range (Beginning Perl > exercise) > > > --- David le Blanc > <[EMAIL PROTECTED]> wrote: >

RE: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread David le Blanc
> -Original Message- > From: Paul Johnson [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 3 March 2004 12:13 AM > To: David le Blanc > Cc: [EMAIL PROTECTED] > Subject: RE: listing prime numbers in a range (Beginning Perl > exercise) > > > David le Blanc sai

RE: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread Paul Johnson
David le Blanc said: > Here is a summary of the posted prime calculators for testing your > results against. And here's a previous thread with few more scripts: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=005101c25d82%2475841fc0%243e861199%40pcf594.nmc-m.dtag.de&rnum=1&p

RE: listing prime numbers in a range (Beginning Perl exercise)

2004-03-02 Thread David le Blanc
Level 1, 369 Camberwell Road, Melbourne, Vic 3124 Ph 03 9813 1388 Fax 03 9813 1688 Mobile 0417 595 550 Email [EMAIL PROTECTED] > -Original Message- > From: Stuart White [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 2 March 2004 11:14 AM > To: James Edward Gray II

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-03-01 Thread Stuart White
> That's not really accurate. What was said to that: > > @list = "@list"; > > Creates a joined string of elements and replaces the > list with that one > item. It's perfectly reasonable to stringify an > array, without > altering the array's contents: > > print "@list\n"; > I'm not sure I

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread R. Joseph Newton
Stuart White wrote: > So I figured out from folks on the list, Beginning > Perl, and some print statements that > @list = (2 .. $input); > > puts the range of numbers into an array, and that if I > stringified it, then it would put the entire range > into $list[0] > >

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread James Edward Gray II
On Feb 28, 2004, at 11:12 AM, Stuart White wrote: So I figured out from folks on the list, Beginning Perl, and some print statements that @list = (2 .. $input); Good work. puts the range of numbers into an array, and that if I stringified it, then it would put the entire range into $list[0

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread Stuart White
So I figured out from folks on the list, Beginning Perl, and some print statements that @list = (2 .. $input); puts the range of numbers into an array, and that if I stringified it, then it would put the entire range into $list[0] Now that I've figured that bit out, I went on to remove al

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread Stuart White
So I figured out from folks on the list, Beginning Perl, and some print statements that @list = (2 .. $input); puts the range of numbers into an array, and that if I stringified it, then it would put the entire range into $list[0] Now that I've figured that bit out, I went on to remove al

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-25 Thread R. Joseph Newton
Stuart White wrote: > > Yes, that's what I was doing at first. Then I > consulted "Beginning Perl," and it told me that I had > to "stringify" the list to get spaces in between the > numbers. Hi Stuart, Well, it does seem to work that way, but you shou

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-25 Thread John W. Krahn
Stuart White wrote: > > --- Rob Dixon <[EMAIL PROTECTED]> wrote: > > > > my $input = " 22 \n"; > > my @list = (2 .. $input); > > print "list first: @list\n"; > > > > **OUTPUT > > > > list first: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 > > 17 18 19 20 21 22 > > > > Does putting a space befor

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-25 Thread John W. Krahn
Stuart White wrote: > > > > > > Of course, then all the numbers are squished > > together. > > > (How else might I say that?) > > > > I don't know, what do you mean by "squished > > together"? > > > without spaces between each number. (it was late last > night and I had a mental block.) > > >

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-25 Thread Stuart White
--- Rob Dixon <[EMAIL PROTECTED]> wrote: > Hi Stuart. Mornin' Rob. > My guess is that you're looking at the output from > > print @list; Yes, that's what I was doing at first. Then I consulted "Beginning Perl," and it told me that I had to "

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-25 Thread Rob Dixon
Hi Stuart. Stuart White wrote: > > > > > > Of course, then all the numbers are squished > > together. > > > (How else might I say that?) > > > > I don't know, what do you mean by "squished > > together"? > > > without spaces between each number. (it was late last > night and I had a mental bloc

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-25 Thread Stuart White
> > Of course, then all the numbers are squished > together. > > (How else might I say that?) > > I don't know, what do you mean by "squished > together"? > without spaces between each number. (it was late last night and I had a mental block.) > > So my solution is to > > "stringify" the ar

RE: listing prime numbers in a range (Beginning Perl exercise)

2004-02-25 Thread Ohad Ohad
of why it works is quite tedious. Ohad From: Stuart White <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: listing prime numbers in a range (Beginning Perl exercise) Date: Tue, 24 Feb 2004 20:01:51 -0800 (PST) I'm working through Beginning Perl, and I'm stuck on a particular exercis

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-24 Thread John W. Krahn
Stuart White wrote: > > I'm working through Beginning Perl, and I'm stuck on a > particular exercise. The exercise asks me to take a > number from and print all the prime numbers > between 2 and that number. (ch 4, pg 145, #3) > > I can take the number from the

listing prime numbers in a range (Beginning Perl exercise)

2004-02-24 Thread Stuart White
I'm working through Beginning Perl, and I'm stuck on a particular exercise. The exercise asks me to take a number from and print all the prime numbers between 2 and that number. (ch 4, pg 145, #3) I can take the number from the user and save it in a scalar. My solution to listing t

Re: getting rid of whitespace at the beginning and end of a string

2003-12-12 Thread John W. Krahn
Dan Anderson wrote: > > Is there a way to chomp all whitespace both at the beginning and end of > a string? That is what is known as a Frequently Asked Question or FAQ. Perl provides copious amounts of documentation including a large list of FAQs in the perlfaq.pod file. Perl also p

RE: getting rid of whitespace at the beginning and end of a string

2003-12-12 Thread Charles K. Clarkson
Dan Anderson <[EMAIL PROTECTED]> wrote: : Is there a way to chomp all whitespace both at the beginning : and end of a string? I was thinking of using a regexp like : s[^\s*?][]sg and s[\s*?$][]sg; Is there a better way? : (I'm thinking of PHP's trim function) See perlfaq4:

Re: getting rid of whitespace at the beginning and end of a string

2003-12-12 Thread James Edward Gray II
On Dec 12, 2003, at 1:51 PM, Dan Anderson wrote: Is there a way to chomp all whitespace both at the beginning and end of a string? I was thinking of using a regexp like s[^\s*?][]sg and s[\s*?$][]sg; Is there a better way? (I'm thinking of PHP's trim function) I imagine so becau

Re: getting rid of whitespace at the beginning and end of a string

2003-12-12 Thread drieux
On Dec 12, 2003, at 11:51 AM, Dan Anderson wrote: Is there a way to chomp all whitespace both at the beginning and end of a string? I was thinking of using a regexp like s[^\s*?][]sg and s[\s*?$][]sg; Is there a better way? (I'm thinking of PHP's trim function) the tradition

getting rid of whitespace at the beginning and end of a string

2003-12-12 Thread Dan Anderson
Is there a way to chomp all whitespace both at the beginning and end of a string? I was thinking of using a regexp like s[^\s*?][]sg and s[\s*?$][]sg; Is there a better way? (I'm thinking of PHP's trim function) -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

  1   2   >