Re: pl/perl Documentation
| От | Tom Lane |
|---|---|
| Тема | Re: pl/perl Documentation |
| Дата | |
| Msg-id | 24004.1022077488@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | pl/perl Documentation ("Duncan Adams (DNS)" <duncan.adams@vcontractor.co.za>) |
| Ответы |
Re: pl/perl Documentation
|
| Список | pgsql-novice |
"Duncan Adams (DNS)" <duncan.adams@vcontractor.co.za> writes:
> CREATE or REPLACE FUNCTION remspace(TEXT) RETURN TEXT
> AS '
> @_ =~ s/\s*//;
> return @_'
> LANGUAGE 'plperl';
I'm not much of a Perl hacker, but even I can see that this is not good
Perl. You need a semicolon to finish the return statement, and I think
you want to manipulate the first element of the @_ array, not the whole
array. So something like
CREATE or REPLACE FUNCTION remspace(TEXT) RETURN TEXT AS '
$_[0] =~ s/\s*//;
return $_[0];
' LANGUAGE 'plperl';
would probably do what you want.
I'd recommend getting hold of a book about Perl.
regards, tom lane
В списке pgsql-novice по дате отправления: