What is happening here

2004-03-29 Thread WC -Sx- Jones
What is happening here - #! /usr/bin/perl use strict; use warnings; my $count; while(1) { (++$count) ? $count += $count-- : $count += $count++; print "$count\n"; exit if $count > 60_000; sleep 1; } __END__ -Sx- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

What is happening here

2004-04-09 Thread WC -Sx- Jones
# WARNING: This is a very basic question - Maybe only the beginners should answer it? #! perl use strict; use warnings; my ($first, $last, $out) = ''; while (<>) { if (/^-BEGIN/ .. /^-END/) { if (/^-BEGIN/) { $fir

what is happening here

2004-04-20 Thread WC -Sx- Jones
[Becuase of a recent discussion on Postfix-users list] Would anyone like to expand/explain what, exactly, is // matching below: #! perl use strict; use warnings; my $idx; while () { ++$idx; print "Line $idx - seen $_" if //; } __DATA__ Line 3 Line 5 Thx/Bill -- _Sx_ http://youve-reached-th

What is happening here...?

2001-11-12 Thread Daniel Falkenberg
Hi all, Below is a chunk of code that I don't really know what's going on? Could some one give me a few ideas? perl -F: -i -ape'$F[3] == 45 && s/^/*/' /etc/passwd Regards, Dan == VINTEK CONSULTING PTY LTD (ACN 088 825 209) Email: [EMAIL PROTECTED] WWW:http://w

Re: What is happening here

2004-03-29 Thread Andrew Gaffney
WC -Sx- Jones wrote: What is happening here - #! /usr/bin/perl use strict; use warnings; my $count; while(1) { (++$count) ? $count += $count-- : $count += $count++; print "$count\n"; exit if $count > 60_000; sleep 1; } __END__ -Sx- That is a damn good question. I'm not s

RE: What is happening here

2004-03-29 Thread Tim Johnson
Cc: Subject: What is happening here What is happening here - #! /usr/bin/perl use strict; use warnings; my $count; while(1) { (++$count) ? $count += $count-- : $count += $count++;

Re: What is happening here

2004-03-29 Thread R. Joseph Newton
Andrew Gaffney wrote: > WC -Sx- Jones wrote: > > What is happening here - > > > > #! /usr/bin/perl > > use strict; > > use warnings; > > > > my $count; > > > > while(1) { > > (++$count) ? $count += $count-- : $count += $count++; >

Re: What is happening here

2004-03-29 Thread R. Joseph Newton
"R. Joseph Newton" wrote: > Andrew Gaffney wrote: > > > WC -Sx- Jones wrote: > > > What is happening here - > > That is a damn good question. I'm not sure what results I was expecting when I ran > > it, but > > it sure wasn't this:

Re: What is happening here

2004-03-29 Thread R. Joseph Newton
Tim Johnson wrote: > Apparently (++$count) evaluates to 0, but I can't figure out why. Nope. Always true. It just doesn'yt matter. Bill sorta threw us a red herring here. Seeing the conditiional operator distracts your attention to thinking about the product of the conditional, which is not

Re: What is happening here

2004-03-30 Thread WC -Sx- Jones
WC -Sx- Jones wrote: What is happening here - while(1) { (++$count) ? $count += $count-- : $count += $count++; :) May I ask a different way? #! /usr/bin/perl use strict; use warnings; my $count; my $str; while(1) { (++$count) ? $count += $count-- : $count += $count++; $str

Re: What is happening here

2004-03-30 Thread Jeff 'japhy' Pinyan
On Mar 30, WC -Sx- Jones said: >my $count; > >while(1) { > (++$count) ? $count += $count-- : $count += $count++; > > print "$count\n"; exit if $count > 60_000; > sleep 1; >} The main problem is the PRECEDENCE. Your ? : line is run like so: ((++$count) ? ($count += $count--) : $count) +=

Re: What is happening here

2004-03-30 Thread WC -Sx- Jones
#! /usr/bin/perl use strict; use warnings; my $count; my $index; my $str; while (++$index) { $count = $index; while(1) { (++$count) ? $count += $count-- : $count += $count++; $str = unpack("B32", pack("N", $count)); print "$count \tis binary $str\n"; last if $coun

RE: What is happening here

2004-03-30 Thread Charles K. Clarkson
WC -Sx- Jones <[EMAIL PROTECTED]> wrote: : : PS - I am admit that I am likely in the middle of : a nervous break-down LOL :) You should be in just the right frame of mind for delving into Parse::RecDecent. :) Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe,

Re: What is happening here

2004-03-30 Thread R. Joseph Newton
WC -Sx- Jones wrote: > WC -Sx- Jones wrote: > > What is happening here - > > while(1) { > > (++$count) ? $count += $count-- : $count += $count++; > > > > :) May I ask a different way? > > #! /usr/bin/perl > use strict; > use warnings; > >

Re: What is happening here

2004-03-30 Thread R. Joseph Newton
Jeff 'japhy' Pinyan wrote: > On Mar 30, WC -Sx- Jones said: > > >my $count; > > > >while(1) { > > (++$count) ? $count += $count-- : $count += $count++; > > > > print "$count\n"; exit if $count > 60_000; > > sleep 1; > >} > > The main problem is the PRECEDENCE. Your ? : line is run like so:

Re: What is happening here

2004-03-30 Thread Paul Johnson
On Tue, Mar 30, 2004 at 04:57:07PM -0800, R. Joseph Newton wrote: > Jeff 'japhy' Pinyan wrote: > > > On Mar 30, WC -Sx- Jones said: > > > > >my $count; > > > > > >while(1) { > > > (++$count) ? $count += $count-- : $count += $count++; > > > > > > print "$count\n"; exit if $count > 60_000; > > >

Re: What is happening here

2004-03-31 Thread Jeff 'japhy' Pinyan
On Mar 30, R. Joseph Newton said: >Jeff 'japhy' Pinyan wrote: > >> The main problem is the PRECEDENCE. Your ? : line is run like so: >> >> ((++$count) ? ($count += $count--) : $count) += $count++; > >Have you tested this? I don't see the precedence issue happening here. >Could you try duplicat

Re: What is happening here

2004-04-09 Thread James Edward Gray II
On Apr 9, 2004, at 3:52 PM, WC -Sx- Jones wrote: # WARNING: This is a very basic question - Maybe only the beginners should answer it? Spoiler Warning! Stop reading here, if you want to solve it yourself... #! perl use strict; use warnings; my ($first, $last, $out) = '';

Re: what is happening here

2004-04-20 Thread Rob Dixon
Wc -Sx- Jones wrote: > > [Becuase of a recent discussion on Postfix-users list] > Would anyone like to expand/explain what, exactly, is // matching below: > > #! perl > > use strict; > use warnings; > > my $idx; > > while () { > ++$idx; print "Line $idx - seen $_" if //; > } > __DATA__ > > > L

RE: what is happening here

2004-04-20 Thread Charles K. Clarkson
WC -Sx- Jones <[EMAIL PROTECTED]> wrote: : : [Becuase of a recent discussion on Postfix-users list] : Would anyone like to expand/explain what, exactly, is // : matching below: The first iteration of the loop, // matches a zero-length string. Each subsequent time it matches the last successf

Re: What is happening here...?

2001-11-12 Thread Curtis Poe
--- Daniel Falkenberg <[EMAIL PROTECTED]> wrote: > Hi all, > > Below is a chunk of code that I don't really know what's going on? > Could some one give me a few ideas? > > perl -F: -i -ape'$F[3] == 45 && s/^/*/' /etc/passwd > > Regards, > > Dan Dan, Here's a list of the command line switches

RE: What is happening here...?

2001-11-12 Thread Daniel Falkenberg
Curtis, Cheers for that that makes alot more sense now :). Yes your are correct about the /etc/passwd file. It's all well and good to be able to issue that command from a command line, but what if I wanted to issue the exact same code but from a script? Regards, Dan Dan, Here's a list of th

RE: What is happening here...?

2001-11-12 Thread Curtis Poe
--- Daniel Falkenberg <[EMAIL PROTECTED]> wrote: > Curtis, > > Cheers for that that makes alot more sense now :). Yes your are correct > about the /etc/passwd file. It's all well and good to be able to issue > that command from a command line, but what if I wanted to issue the > exact same code

Re: What is happening here...?

2001-11-12 Thread John W. Krahn
Daniel Falkenberg wrote: > > Curtis, > > Cheers for that that makes alot more sense now :). Yes your are correct > about the /etc/passwd file. It's all well and good to be able to issue > that command from a command line, but what if I wanted to issue the > exact same code but from a script?

Re: What is happening here...?

2001-11-12 Thread John W. Krahn
"John W. Krahn" wrote: > > Daniel Falkenberg wrote: > > > > Curtis, > > > > Cheers for that that makes alot more sense now :). Yes your are correct > > about the /etc/passwd file. It's all well and good to be able to issue > > that command from a command line, but what if I wanted to issue the