On Thu, Aug 3, 2017 at 3:29 PM hw wrote:
> David Mertens wrote:
> It is nonsense to logically negate a string, and it is nonsense to convert
> undefined values into 'false'.
Negating strings is a well defined operation in Perl 5. The following
values in Perl 5 are false: undef, 0, 0.0, "", "0"
On Thu, Aug 03, 2017 at 09:27:42PM +0200, hw wrote:
>
> It is nonsense to logically negate a string, and it is nonsense to convert
> undefined values into 'false'. Either are neither false, nor true.
>
> For undefined values, there is no way of deciding whether they are true or
> false
> becaus
David Mertens wrote:
On Thu, Jul 6, 2017 at 11:05 PM, mailto:sisyph...@optusnet.com.au>> wrote:
Perl is highly unusual in that the operator, not the operand, dictates
the context.
Good point - and one that I hadn't got around to noticing.
Therefore, the '!' operator has to be
On Thu, Jul 6, 2017 at 11:05 PM, wrote:
> Perl is highly unusual in that the operator, not the operand, dictates the
>> context.
>>
>
> Good point - and one that I hadn't got around to noticing.
>
> Therefore, the '!' operator has to be set up to either:
> a) operate always in numeric context;
>
t: Friday, July 07, 2017 12:07 PM
To: Sisyphus
Cc: Chas. Owens ; hw ; Perl Beginners
Subject: Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print
"i: $i\n";'
On Thu, Jul 6, 2017 at 9:12 PM, wrote:
I find it a little surprising that use of the '!
From: David Mertens
Sent: Friday, July 07, 2017 12:07 PM
To: Sisyphus
Cc: Chas. Owens ; hw ; Perl Beginners
Subject: Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i:
$i\n";'
On Thu, Jul 6, 2017 at 9:12 PM, wrote:
I find it a little surprising that use of
On Thu, Jul 6, 2017 at 9:12 PM, wrote:
> I find it a little surprising that use of the '!' operator is all that's
> needed to add the stringification stuff:
>
> ...
>
> If the '!' operator didn't do that, then I believe the OP would be seeing
> precisely what he expects.
>
> So ... why should the
From: Chas. Owens
Sent: Friday, July 07, 2017 12:34 AM
To: hw ; beginners@perl.org
Subject: Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i:
$i\n";'
On Thu, Jul 6, 2017 at 9:38 AM hw wrote:
Chas. Owens wrote:
$i started off as an IV, but gets promoted to
On Thu, Jul 6, 2017 at 9:33 AM hw wrote:
> False and true are genuinely numeric. You can´t say for a string
> whether it is true or false; it is a string.
>
This is not a true statement in Perl. All values in Perl can be true or
false. And the prototypical true and false values, PL_sv_yes and
On Thu, Jul 6, 2017 at 9:38 AM hw wrote:
> Chas. Owens wrote:
> >
> >
> > On Sat, Jul 1, 2017, 12:44 Shlomi Fish shlo...@shlomifish.org>> wrote:
> >
> > Hi Shawn!
> >
> > On Sat, 1 Jul 2017 11:32:30 -0400
> > Shawn H Corey mailto:shawnhco...@gmail.com>>
> wrote:
> >
> > > !!$i wh
X Dungeness wrote:
It's about what unary ! (bang operator) does to the operand
Here's the dissonance:
perl -E '$x=0; say "x=$x"; $x = !!$x; say "x=$x"'
x=0
x=
It behaves as you expect until you "bang" it twice.
I found a good explanation in the Camel:
"Unary ! performs logical negation, that
Chas. Owens wrote:
On Sat, Jul 1, 2017, 12:44 Shlomi Fish mailto:shlo...@shlomifish.org>> wrote:
Hi Shawn!
On Sat, 1 Jul 2017 11:32:30 -0400
Shawn H Corey mailto:shawnhco...@gmail.com>> wrote:
> !!$i which is !(!(0)) which is !(1) which is 0
>
I suspect !1 returns an
Shlomi Fish wrote:
Hi hw!
Please see
http://www.shlomifish.org/philosophy/computers/netiquette/email/reply-to-list.html
.
On Sat, 1 Jul 2017 19:15:22 +0200 hw wrote:
Shlomi Fish wrote:
Hi Shawn!
On Sat, 1 Jul 2017 11:32:30 -0400
Shawn H Corey wrote:
On Sat, 1 Jul 2017 17:27:02 +0200
hw
It's about what unary ! (bang operator) does to the operand
Here's the dissonance:
perl -E '$x=0; say "x=$x"; $x = !!$x; say "x=$x"'
x=0
x=
It behaves as you expect until you "bang" it twice.
I found a good explanation in the Camel:
"Unary ! performs logical negation, that is "not". The value
What are these emails really about?
On Jul 1, 2017 2:42 PM, "Chas. Owens" wrote:
>
>
> On Sat, Jul 1, 2017, 12:44 Shlomi Fish wrote:
>
>> Hi Shawn!
>>
>> On Sat, 1 Jul 2017 11:32:30 -0400
>> Shawn H Corey wrote:
>>
>> > !!$i which is !(!(0)) which is !(1) which is 0
>> >
>>
>> I suspect !1 ret
On Sat, Jul 1, 2017, 12:44 Shlomi Fish wrote:
> Hi Shawn!
>
> On Sat, 1 Jul 2017 11:32:30 -0400
> Shawn H Corey wrote:
>
> > !!$i which is !(!(0)) which is !(1) which is 0
> >
>
> I suspect !1 returns an empty string in scalar context.
>
!1 returns PL_sv_no (an internal scalar variable). It is
Hi hw!
Please see
http://www.shlomifish.org/philosophy/computers/netiquette/email/reply-to-list.html
.
On Sat, 1 Jul 2017 19:15:22 +0200 hw wrote:
> Shlomi Fish wrote:
> > Hi Shawn!
> >
> > On Sat, 1 Jul 2017 11:32:30 -0400
> > Shawn H Corey wrote:
> >
> >> On Sat, 1 Jul 2017 17:27:02 +0200
Hi Shawn!
On Sat, 1 Jul 2017 11:32:30 -0400
Shawn H Corey wrote:
> On Sat, 1 Jul 2017 17:27:02 +0200
> hw wrote:
>
> >
> > Hi,
> >
> > can someone please explain this:
> >
> >
> > perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'
> > i:
> >
> >
> > Particularly:
> >
>
On Sat, 1 Jul 2017 17:27:02 +0200
hw wrote:
>
> Hi,
>
> can someone please explain this:
>
>
> perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'
> i:
>
>
> Particularly:
>
>
> + Why doesn´t it print 1?
Because !!$i is zero
>
> + How is this not a bug?
Nope, no bug.
On 2012-02-24 10:32:37 -0500, Steve Bertrand wrote:
> Hi all,
Hello:
> Lately, I have seen many command-line one-liners floating around
> with the -E argument:
>
> perl -E '#do stuff'
>
> Could somebody kindly remind me which perldoc I need to review to
> find out about the differences between
perl --help
Will explain what the switches do...
Regards...
On Feb 24, 2012, at 10:32 AM, Steve Bertrand wrote:
> Hi all,
>
> Lately, I have seen many command-line one-liners floating around with the -E
> argument:
>
> perl -E '#do stuff'
>
> Could somebody kindly remind me which perldoc I
On 12-02-24 10:32 AM, Steve Bertrand wrote:
Hi all,
Lately, I have seen many command-line one-liners floating around with
the -E argument:
perl -E '#do stuff'
Could somebody kindly remind me which perldoc I need to review to find
out about the differences between -e and -E?
Steve
perldoc p
On 3/22/07, Alan Campbell <[EMAIL PROTECTED]> wrote:
>> sounds like advice is to not bother w/ perl -e. Seems a pity. Looked like a
perfect job for perl -e but perhaps its pushing it a bit.
I think the advice is not so much not to use perl -e, but rather that
you should be using Perl for the w
On 3/22/07, Alan Campbell <[EMAIL PROTECTED]> wrote:
>> true, but I'm tweaking the orig array in-place. So how to modify a given
element if I dont have some index?
With foreach, you don't need an index. The control variable of a
foreach isn't a copy of the array element; it *is* the element of
hello,
Good questions.
> I'm trying to use cmd line perl -e to do some fairly basic sed-style
> find/replace.
Why don't you just use sed for that, if you're not doing the main
program in Perl? Maybe I'm misunderstanding you, but it sounds like
you're saying that you're writing shell scripts in
On 3/21/07, Alan Campbell <[EMAIL PROTECTED]> wrote:
I'm trying to use cmd line perl -e to do some fairly basic sed-style
find/replace.
Why don't you just use sed for that, if you're not doing the main
program in Perl? Maybe I'm misunderstanding you, but it sounds like
you're saying that you'
26 matches
Mail list logo