diff options
| -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; |
