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 (DATA) {
++$idx; print Line $idx - seen $_ if //;
}
__DATA__
Line 3
Line 5
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
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) =
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 duplicating these
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 =
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) += $count++;
#! /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 $count
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,
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;
my $count;
my $str;
while(1) {
(++$count) ? $count += $count--
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:
((++$count) ?
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;
sleep 1;
}
The main
Apparently (++$count) evaluates to 0, but I can't figure out why. So the second
expression is evaluated first. From there it's pretty self-explanatory. (++$count)
will always evaluate to TRUE, since it will only get higher, and the first expression
is evaluated.
Maybe someone can enlighten
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++;
print $count\n; exit if $count 60_000;
sleep 1;
}
__END__
-Sx-
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:
3
15
63
255
I'm stumped, also.I would have expected progressive
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
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
exact same
16 matches
Mail list logo