[ sale83 @ 29.08.2009. 10:37 ] @
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
[ stale85 @ 09.09.2009. 21:11 ] @
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.