diff options
| author | Luca Ferrari <fluca1978@gmail.com> | 2022-10-03 10:56:21 +0200 |
|---|---|---|
| committer | Luca Ferrari <fluca1978@gmail.com> | 2022-10-03 10:56:21 +0200 |
| commit | 9e9bb92d4b8dca13c73b28ea23d861e32d975839 (patch) | |
| tree | dc9cefb7f0bf5848a6c37937e874bf8aec4d0679 | |
| parent | 47ee5bdb4bafb5d4134182bbce243a6cde566cb9 (diff) | |
| download | perlweeklychallenge-club-9e9bb92d4b8dca13c73b28ea23d861e32d975839.tar.gz perlweeklychallenge-club-9e9bb92d4b8dca13c73b28ea23d861e32d975839.tar.bz2 perlweeklychallenge-club-9e9bb92d4b8dca13c73b28ea23d861e32d975839.zip | |
Task 1 plperl done
| -rw-r--r-- | challenge-185/luca-ferrari/postgresql/ch-1.plperl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-185/luca-ferrari/postgresql/ch-1.plperl b/challenge-185/luca-ferrari/postgresql/ch-1.plperl new file mode 100644 index 0000000000..9c4ca45b8e --- /dev/null +++ b/challenge-185/luca-ferrari/postgresql/ch-1.plperl @@ -0,0 +1,23 @@ +-- Perl Weekly Challenge 185 +-- Task 1 + +CREATE SCHEMA IF NOT EXISTS pwc185; + +CREATE OR REPLACE FUNCTION +pwc185.task1_plperl( text ) +RETURNS text +AS $CODE$ +my ( $input ) = @_; + +$input =~ s/\./g/; + +my ( $counter, $output ) = ( 1, '' ); +for ( split( //, $input ) ) { + $output .= $_; + $output .= ':' if $counter % 2 == 0; + $counter++; +} + +return $output; +$CODE$ +LANGUAGE plperl; |
