[Israel.pm] Perl Advocacy
Shlomi Fish
shlomif at iglu.org.il
Mon Dec 27 09:01:34 PST 2004
On Monday 27 December 2004 18:10, Gabor Szabo wrote:
> On Mon, 27 Dec 2004, Offer Kaye wrote:
> >> Worse than that there is no trim that would remove spaces from the
> >> beginning and the end of a string.
> >
> > I didn't understand this, Gabor. Please explain.
>
> I wrote this for educational reasons.
> Thanks Dov for your solution.
>
> another str_replace [1]
>
> sub str_replace {
> my ($str, %map) = @_;
> $str =~ s/(.)/ defined $map{$1} ? $map{$1} : $1 /eg;
> return $str;
> }
>
Since the pattern match is . which is a single character it will only work if
the strings to replace are single-charactered. And you should probably use
"exists" rather than "defined".
>
> Every language has to decide what size are the building blocks it is
> using and what is the level of abstraction. I think there is no right
> or wrong way. They fit to a different audience and different purposes.
>
> A a native Parrot programmer would say: Perl is just bloated.
>
Parrot?
Regards,
Shlomi Fish
>
> BTW Is there a module Functions::PHP that exports those 3000 functions
> PHP has ? If no such module, what about writing one ?
>
>
>
> Gabor
>
> [1] I fear the golfers now
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
--
---------------------------------------------------------------------
Shlomi Fish shlomif at iglu.org.il
Homepage: http://www.shlomifish.org/
Knuth is not God! It took him two days to build the Roman Empire.
More information about the Perl
mailing list