Re: perlsub - Mailing list pgsql-novice

From Martin_vi_Lange@t-online.de (Martin Lange)
Subject Re: perlsub
Date
Msg-id 1645556986.20031005150317@t-online.de
Whole thread Raw
In response to perlsub  (Nabil Sayegh <postgresql@e-trolley.de>)
Responses Re: perlsub
List pgsql-novice
Hello Nabil,

you worte at 2003-10-04T01:29:00:

> perlsub:
> -----------------------------------------------
> CREATE FUNCTION perlsub(text, text, text) RETURNS text AS '
>      my ($data, $pat, $repl) = @_;
>      $data =~ s/$pat/$repl/;
>      return $data
> ' LANGUAGE 'plperl';
> -----------------------------------------------

> SELECT perlsub('a=b','([^=]+)=(.+)','key:$1;val:$2');

> Any idea ? Just a matter of quoting ?

What I understand: You want to split some data into a pair of key
and value.

So, just do that:

    ($key, $val) = split(/=/, $data);

HTH.

cya :-)
Martin "vi"


pgsql-novice by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: perlsub
Next
From: Nabil Sayegh
Date:
Subject: Re: perlsub