[QUIZ] Perl 'Easy' Quiz #2005-2
From: Shlomi Fish <shlomif@...>
Subject: [QUIZ] Perl 'Easy' Quiz #2005-2
Newsgroups: gmane.comp.lang.perl.qotw.discuss
Date: 2005-02-02 17:54:19 GMT
Subject: [QUIZ] Perl 'Easy' Quiz #2005-2
Newsgroups: gmane.comp.lang.perl.qotw.discuss
Date: 2005-02-02 17:54:19 GMT
IMPORTANT: Please do not post solutions, hints, or other spoilers
until at least 60 hours after the date of this message.
Thanks.
I've been on FreeNode's #perl channel one day when someone asked how to remove
all periods from a string except the last one. So for example
"this.is.a.file.txt" will become "thisisafile.txt".
Your mission is to write as many different solutions as possible to this
problem. You should write functions which will accept a single scalar
argument containing the string, and return a single scalar containing the
modified string.
So for example if the function is called "myfunc", the following code:
<<<
print myfunc("this.is.a.file.txt");
>>>
Will print:
thisisafile.txt
Regards,
Shlomi Fish
---------------------------------------------------------------------
Shlomi Fish shlomif@...
Homepage: http://www.shlomifish.org/
Knuth is not God! It took him two days to build the Roman Empire.
RSS Feed