Strange behaviour of PL/Perl

From: "Andrey Y(dot) Mosienko" <feo(at)ttn(dot)ru>
To: Postgres <pgsql-general(at)postgresql(dot)org>
Subject: Strange behaviour of PL/Perl
Date: 2001-02-24 13:55:27
Message-ID: 3A97BD4F.4806806E@ttn.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)ttn(dot)ru, feo(at)feo(dot)org(dot)ru
ICQ: 28073807

Responses

Browse pgsql-general by date

  From Date Subject
Next Message J.H.M. Dassen Ray 2001-02-24 13:57:58 Re: PostgreSQL packages for Debian potato
Previous Message Tatsuo Ishii 2001-02-24 13:05:37 Re: Encoding: LATIN2 (hungary)