Re: last

2013-06-27 Thread shawn wilson
On Fri, Jun 28, 2013 at 12:04 AM, Charles DeRykus wrote: > > > > On Thu, Jun 27, 2013 at 1:31 PM, Dr.Ruud wrote: >> >> On 27/06/2013 22:01, Shawn H Corey wrote: >>> >>> On Thu, 27 Jun 2013 21:53:46 +0200 >>> "Dr.Ruud" wrote: See also 'Statement Modifiers' in perlsyn. There it is s

Re: last

2013-06-27 Thread Charles DeRykus
On Thu, Jun 27, 2013 at 1:31 PM, Dr.Ruud wrote: > On 27/06/2013 22:01, Shawn H Corey wrote: > >> On Thu, 27 Jun 2013 21:53:46 +0200 >> "Dr.Ruud" wrote: >> > See also 'Statement Modifiers' in perlsyn. >>> There it is shown how to make next and last work with do{}. I read >>> that as a rather fun

Re: printing content of a pipe

2013-06-27 Thread Uri Guttman
On 06/27/2013 06:07 PM, Rajeev Prasad wrote: in the below code I am not able to print anything except whatever is in the $pty. I want to print LINE_START: in the beginning of each line of the output, but it does not print that, it only prints what the output of the exceuted command produced.

printing content of a pipe

2013-06-27 Thread Rajeev Prasad
in the below code I am not able to print anything except whatever is in the $pty.  I want to print LINE_START: in the beginning of each line of the output, but it does not print that, it only prints what the output of the exceuted command produced. why is that so?     while(<$pty>) {          

Re: last

2013-06-27 Thread Dr.Ruud
On 27/06/2013 22:01, Shawn H Corey wrote: On Thu, 27 Jun 2013 21:53:46 +0200 "Dr.Ruud" wrote: See also 'Statement Modifiers' in perlsyn. There it is shown how to make next and last work with do{}. I read that as a rather funny way to discourage people from do-ing it. "Here be dragons." I w

Re: last

2013-06-27 Thread Shawn H Corey
On Thu, 27 Jun 2013 21:53:46 +0200 "Dr.Ruud" wrote: > See also 'Statement Modifiers' in perlsyn. > > There it is shown how to make next and last work with do{}. I read > that as a rather funny way to discourage people from do-ing it. "Here be dragons." I would say that was a warning to avoid it

Re: last

2013-06-27 Thread Dr.Ruud
On 27/06/2013 17:03, Shawn H Corey wrote: On Thu, 27 Jun 2013 07:45:17 -0700 Jim Gibson wrote: Note that the statement modifier syntax allows you to write a do-while or do-until loop, where at least one pass is made through the loop before the loop termination test is performed: do { … }

Re: accessing variables in subroutines

2013-06-27 Thread Dr.Ruud
On 27/06/2013 15:44, Shawn H Corey wrote: On Thu, 27 Jun 2013 15:07:58 +0200 "Dr.Ruud" wrote: On 27/06/2013 12:58, lee wrote: Ok, so perl has a totally broken design with variables :( No, your understanding is broken. Can you come back after you fixed it? That is rude. The reason this li

Re: last

2013-06-27 Thread Andy Bach
On Thu, Jun 27, 2013 at 4:33 AM, lee wrote: > >> > This is sort of a p5p question but the above might cut this off at the > >> > knees (or better show a gap that needs to be filled). > >> > >> What is a p5p question? > In case this was the original quesiont p5p stands for Perl 5 Porters, the lis

Re: accessing variables in subroutines

2013-06-27 Thread Andy Bach
On Thu, Jun 27, 2013 at 11:22 AM, Rob Dixon wrote: > Something like this may help you > > use strict; > use warnings; > > do_something({ title => 'TEST', value => 42 }); > > sub do_something { > my ($params) = @_; > print $params->{title}, "\n"; > do_something_el

Re: last

2013-06-27 Thread Rob Dixon
On 27/06/2013 16:03, Shawn H Corey wrote: On Thu, 27 Jun 2013 07:45:17 -0700 Jim Gibson wrote: Note that the statement modifier syntax allows you to write a do-while or do-until loop, where at least one pass is made through the loop before the loop termination test is performed: do { … } w

Re: last

2013-06-27 Thread Uri Guttman
On 06/27/2013 05:39 AM, lee wrote: John SJ Anderson writes: Lee, have you read the 'statement modifiers' and 'compound statement' portions of 'perldoc perlsyn'? You may find that this clarifies this issue for you. Well yes, I understand that there are two different kinds of 'if' one of which

Re: accessing variables in subroutines

2013-06-27 Thread Rob Dixon
On 27/06/2013 11:58, lee wrote: Shlomi Fish writes: lee wrote: the following example doesn't compile: use strict; use warnings; sub test { print $counter . "\n"; } my $counter = 0; while($counter < 5) { test(); $counter++; } It says "Global symbol "$counter" requires exp

Re: accessing variables in subroutines

2013-06-27 Thread Brandon McCaig
On Thu, Jun 27, 2013 at 12:58:38PM +0200, lee wrote: > The subroutine is never called before $counter is declared, so > it is always available to the subroutine. There should be an > error only for instances when the subroutine is called before > $counter is declared. Much like in C or C++ (and m

Re: last

2013-06-27 Thread Shawn H Corey
On Thu, 27 Jun 2013 07:45:17 -0700 Jim Gibson wrote: > Note that the statement modifier syntax allows you to write a > do-while or do-until loop, where at least one pass is made through > the loop before the loop termination test is performed: > > do { > … > } while condition(); > > The while

Re: last

2013-06-27 Thread Jim Gibson
On Jun 27, 2013, at 2:39 AM, lee wrote: > John SJ Anderson writes: > >> Lee, have you read the 'statement modifiers' and 'compound statement' >> portions of 'perldoc perlsyn'? You may find that this clarifies this >> issue for you. > > Well yes, I understand that there are two different kinds

Re: accessing variables in subroutines

2013-06-27 Thread John SJ Anderson
> That is rude. The reason this list exists is to help people, not to > tell them to go away. No wonder Perl is not a popular language. Agreed. Dr. Ruud, that was uncalled for. You're not obligated to respond to posters, and if that's the best response you have, not responding would be a better ch

Re: accessing variables in subroutines

2013-06-27 Thread Shawn H Corey
On Thu, 27 Jun 2013 15:07:58 +0200 "Dr.Ruud" wrote: > On 27/06/2013 12:58, lee wrote: > > > Ok, so perl has a totally broken design with variables :( > > No, your understanding is broken. Can you come back after you fixed > it? > That is rude. The reason this list exists is to help people, no

Re: accessing variables in subroutines

2013-06-27 Thread timothy adigun
Hi, On 6/27/13, lee wrote: > Shlomi Fish writes: > >> Hi Lee, >> >> On Wed, 26 Jun 2013 10:18:44 +0200 >> lee wrote: >> >>> Hi, >>> >>> the following example doesn't compile: >>> >>> >>> use strict; >>> use warnings; >>> >>> >>> sub test { >>> print $counter . "\n"; >>> } >>> >>> >>> my $cou

Re: accessing variables in subroutines

2013-06-27 Thread Dr.Ruud
On 27/06/2013 12:58, lee wrote: Ok, so perl has a totally broken design with variables :( No, your understanding is broken. Can you come back after you fixed it? -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http:/

Re: accessing variables in subroutines

2013-06-27 Thread Shawn H Corey
On Thu, 27 Jun 2013 12:58:38 +0200 lee wrote: > Ok, so perl has a totally broken design with variables :( What's the > solution to this problem? The usual technique is to declare the configuration variables at the top, followed by the file-scoped variables. It is convention that these variable

Re: accessing variables in subroutines

2013-06-27 Thread lee
Shlomi Fish writes: > Hi Lee, > > On Wed, 26 Jun 2013 10:18:44 +0200 > lee wrote: > >> Hi, >> >> the following example doesn't compile: >> >> >> use strict; >> use warnings; >> >> >> sub test { >> print $counter . "\n"; >> } >> >> >> my $counter = 0; >> while($counter < 5) { >> te

Re: last

2013-06-27 Thread lee
shawn wilson writes: > On Jun 25, 2013 3:11 AM, "lee" wrote: >> >> shawn wilson writes: >> >> > Lee, can you provide an example of another programming language that >> > implements this or a thesis that describes this problem in more depth? >> >> I'm not sure what you mean --- other programming

Re: last

2013-06-27 Thread lee
John SJ Anderson writes: > Lee, have you read the 'statement modifiers' and 'compound statement' > portions of 'perldoc perlsyn'? You may find that this clarifies this > issue for you. Well yes, I understand that there are two different kinds of 'if' one of which is kinda broken (but nonetheless