Strange behaviour of PL/Perl

Поиск
Список
Период
Сортировка
От Andrey Y. Mosienko
Тема Strange behaviour of PL/Perl
Дата
Msg-id 3A97BD4F.4806806E@ttn.ru
обсуждение исходный текст
Ответы Re: Strange behaviour of PL/Perl  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello All!

I just included PL/Perl language in my database.
Created function:

CREATE FUNCTION and_with_mask(int2, int2) RETURNS int2 AS
'
return $_[0] &
$_[1]
' LANGUAGE 'plperl';


select and_with_mask(4,1);
and_with_mask
---------------
             0

select and_with_mask(8,1);
 and_with_mask
---------------
             0

select and_with_mask(16,1);
 and_with_mask
---------------
             1

select and_with_mask(32,1);
 and_with_mask
---------------
             1

And just in Perl:

#!/usr/bin/perl
    $val = 32 &
1;
    print("val = $val\n");

val = 0

Where am I mistaken or something is in PL/Perl?

--
with respection Andrey Feofilactovich.
e-mail: feo@ttn.ru, feo@feo.org.ru
ICQ: 28073807

В списке pgsql-general по дате отправления:

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Encoding: LATIN2 (hungary)
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: ...lame use of casting, looking for workaround...