"Duncan Adams (DNS)" <duncan(dot)adams(at)vcontractor(dot)co(dot)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