Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

[BUG] Ordinary operators - gt i lt vracaju false ?

[es] :: Perl :: [BUG] Ordinary operators - gt i lt vracaju false ?

[ Pregleda: 5159 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

sale83
Australia
Sydney

Član broj: 41625
Poruke: 729
*.tpgi.com.au.



+30 Profil

icon [BUG] Ordinary operators - gt i lt vracaju false ?29.08.2009. u 10:37 - pre 178 meseci
Poz,

Da li neko moze da proveri sledeci kod

Code:

#!/usr/local/bin/perl

my $c = 3;

print "BUG\n";
if ($c gt 20 ){
 print "Test ($c gt 20):$c Is greater than 20\n";
}else {
 print "Test ($c gt 20):$c Is NOT greater than 20\n";
}

if ($c lt 20 ){
 print "Test ($c lt 20):$c Is less than 20\n";
}else {
 print "Test ($c lt 20):$c Is NOT less than 20\n";
}
print "TACNO\n";
if ($c > 20 ){
 print "Test ($c > 20):$c Is greater than 20\n";
}else {
 print "Test ($c > 20):$c Is NOT greater than 20\n";
}

if ($c < 20 ){
 print "Test ($c < 20):$c Is less than 20\n";
}else {
 print "Test ($c < 20):$c Is NOT less than 20\n";
}



Meni ordinary operators gt i lt uvek vracaju FALSE.

Evo ga moj output:
Code:

home@home-esktop:~$ perl test.pl
BUG
Test (3 gt 20):3 Is greater than 20
Test (3 lt 20):3 Is NOT less than 20
TACNO
Test (3 > 20):3 Is NOT greater than 20
Test (3 < 20):3 Is less than 20


Operatori < i > rade odlicno svoje posao dok gt i lt vracaju false. Ocigledno je u pitanju neki BUG


home@home-desktop:~$ perl -v

This is perl, v5.10.0 built for i486-linux-gnu-thread-multi

Copyright 1987-2007, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Pag

Sto mozes danas ne ostavljaj za sutra!
 
Odgovor na temu

stale85
Stanislav Antic
Student
Sremčica

Član broj: 6670
Poruke: 120
*.dynamic.sbb.rs.



Profil

icon Re: [BUG] Ordinary operators - gt i lt vracaju false ?09.09.2009. u 21:11 - pre 177 meseci
Pod jedan nemoj brzo da zakljucujes da je upitanju bug. U tvom slucaju samo nisi koristio operatore kako treba. Da si pogledao "perldoc perlop" video bi da (gt, lt, eq) sluze za poredjenje stringova.

Code:

$ perl -e 'print "A is less than B" if "A" lt "B" '


Takodje pogledaj dokumentaciju koja dolazi sa perl-om i preporucujem ti sl. sajtove:
Perl101
Perl-begin

I u izdanju MikroKnjige imas Naucite Perl, 4ed.
Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what’s wrong.”
 
Odgovor na temu

[es] :: Perl :: [BUG] Ordinary operators - gt i lt vracaju false ?

[ Pregleda: 5159 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.