Re: [QUIZ] Perl 'Easy' Quiz #2005-2

Shlomi Fish <shlomif-ik1l9ssToec+JF/[email protected]> Thu, 3 Feb 2005 11:25:20 +0200
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
I'm replying to the list.

On Wednesday 02 February 2005 21:38, you wrote:
> Do we need to worry about the case where there are no periods in the
> string?
>

Yes. If the string is "hello" (with no periods) it should return "hello".

Regards,

	Shlomi Fish

> -b
>
> Shlomi Fish wrote:
> > 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-ik1l9ssToec+JF/[email protected]
>
> > Homepage:        http://www.shlomifish.org/
> >
> > Knuth is not God! It took him two days to build the Roman Empire.

-- 

---------------------------------------------------------------------
Shlomi Fish      shlomif-ik1l9ssToec+JF/[email protected]
Homepage:        http://www.shlomifish.org/

Knuth is not God! It took him two days to build the Roman Empire.