How do I say NOT in Perl?
am 11.07.2006 23:19:25 von HerbFHow do write NOT-variable in Perl?
In javascript, I'd write !variable. In Perl I seem to be forced to say,
e.g., if (variable !==1) {yada}.
Thanks in advance,
Herb
How do write NOT-variable in Perl?
In javascript, I'd write !variable. In Perl I seem to be forced to say,
e.g., if (variable !==1) {yada}.
Thanks in advance,
Herb
On 2006-07-11, HerbF@X.net
> How do write NOT-variable in Perl?
>
> In javascript, I'd write !variable. In Perl I seem to be forced to say,
> e.g., if (variable !==1) {yada}.
"if (!$x)" should work fine.
What's the actual code that's not working for you?
dha
--
David H. Adler -
perl -e 'print "Just another P$0-r-l hacker"'
HerbF@X.net wrote:
> How do write NOT-variable in Perl?
>
> In javascript, I'd write !variable. In Perl I seem to be forced to say,
> e.g., if (variable !==1) {yada}.
david:~$ perl -Mstrict -Mwarnings -e'my $v = 1; if (!$v) { print "V is not a
true value\n"; } else { print "V is a true value\n"; }'
V is a true value
--
David Dorward
Home is where the ~/.bashrc is
On 2006-07-11, David Dorward
> HerbF@X.net wrote:
>
>> How do write NOT-variable in Perl?
>>
>> In javascript, I'd write !variable. In Perl I seem to be forced to say,
>> e.g., if (variable !==1) {yada}.
>
> david:~$ perl -Mstrict -Mwarnings -e'my $v = 1; if (!$v) { print "V is not a
> true value\n"; } else { print "V is a true value\n"; }'
> V is a true value
My next question is, what were you expecting to happen? Since $v *does*
have a true value, that's pretty much what I would expect...
dha
--
David H. Adler -
New Songs/New Members/New CD/Same rotten attitude
- Raving Noah press release
"David H. Adler"
> On 2006-07-11, David Dorward
>> HerbF@X.net wrote:
>>
>>> How do write NOT-variable in Perl?
>>>
>>> In javascript, I'd write !variable. In Perl I seem to be forced to say,
>>> e.g., if (variable !==1) {yada}.
>>
>> david:~$ perl -Mstrict -Mwarnings -e'my $v = 1; if (!$v) { print "V is not a
>> true value\n"; } else { print "V is a true value\n"; }'
>> V is a true value
>
> My next question is, what were you expecting to happen? Since $v *does*
> have a true value, that's pretty much what I would expect...
I think David D. was expecting just what he got, and wrote the above to show
that the negation operator ! works just like it does in JS.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
HerbF@X.net scribed:
>How do write NOT-variable in Perl?
>
>In javascript, I'd write !variable. In Perl I seem to be forced to say,
>e.g., if (variable !==1) {yada}.
>
Thanks to all for the help. It works fine. I must have had another issue
that I wasn't aware of.
Herb
Sherm Pendley wrote:
> "David H. Adler"
>> On 2006-07-11, David Dorward
>>> HerbF@X.net wrote:
>>>> In javascript, I'd write !variable. In Perl I seem to be forced to say,
>>>> e.g., if (variable !==1) {yada}.
>>> david:~$ perl -Mstrict -Mwarnings -e'my $v = 1; if (!$v) { print "V is
>>> not a true value\n"; } else { print "V is a true value\n"; }'
>>> V is a true value
> I think David D. was expecting just what he got, and wrote the above to
> show that the negation operator ! works just like it does in JS.
Indeed (contrary to what the OP stated)
--
David Dorward
Home is where the ~/.bashrc is
On 2006-07-12, David Dorward
> Sherm Pendley wrote:
>> "David H. Adler"
>>> On 2006-07-11, David Dorward
>>>> HerbF@X.net wrote:
>
>>>>> In javascript, I'd write !variable. In Perl I seem to be forced to say,
>>>>> e.g., if (variable !==1) {yada}.
>
>>>> david:~$ perl -Mstrict -Mwarnings -e'my $v = 1; if (!$v) { print "V is
>>>> not a true value\n"; } else { print "V is a true value\n"; }'
>>>> V is a true value
>
>> I think David D. was expecting just what he got, and wrote the above to
>> show that the negation operator ! works just like it does in JS.
>
> Indeed (contrary to what the OP stated)
Right. serves me right for not reading headers. :-)
dha, goes back into hiding
--
David H. Adler -
"If you want a real optimist, look up Ray Bradbury. Guy's nuts.
He actually likes people." - David Brin