Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Murder of a Perl coder (announced)

by EdwardG (Vicar)
on Oct 13, 2004 at 13:25 UTC ( #398852=note: print w/replies, xml ) Need Help??


in reply to Murder of a Perl coder (announced)

You have my sympathy for your bad feelings, but maybe all is not lost. I learned Perl before I learned C# and .Net, and maybe right now it is hard to believe but C# can be almost as much fun as Perl.

I recommend that you explore the Regex support in .Net (System.Text.RegularExpressions). You should know that it is a publicly stated goal for the .Net framework to be compatible with Perl 5 - and on top of that it adds features like named captures.

One of the things I miss most about Perl is the one-liners, but then I think I can leave this as idiomatic of Perl and be content.

I don't think your Perls of wisdom will be devoured, remind yourself that you will always know that there's another way to do things, and whenever you want you can

perl -e "while(<>){s/abc/def/ig; print}"

...while all those around you are doing

using System; using System.IO; using System.Text.RegularExpressions; namespace YourCompanyName { class myClass { public static void Main() { StreamReader sr = new StreamReader(); ...and on and on and on... } } }

 

Replies are listed 'Best First'.
Re^2: Murder of a Perl coder (announced)
by itub (Priest) on Oct 13, 2004 at 13:43 UTC
    Why do perl -e "while (<>){s/abc/def/ig; print}" when you can do perl -pe "s/abc/def/ig" ?

      Because someone's got to supply material for the Type D monks. ;-)

       

      Because there are more important things to remember than perl command line switches.
Re^2: Murder of a Perl coder (announced)
by Jenda (Abbot) on Oct 14, 2004 at 20:31 UTC

    You mean you looked at, even used the RegExps in C# and did not throw up? Man you have a good stomach!

    A global match that gives you a data structure five levels deep made of five different types of objects? Replacement that's either a completely static string or a "reference to a function" (for .Net guys "a delegate") that has to be defined somewhere far off because C# doesn't support unnamed functions/blocks? I've seen several examples in C# that implemented something like s{%(\w+)%}{$hash{$1}}g;. None of them was shorter than some twenty lines and each and every one of them was ugly and hard to understand. Shame I don't have the book here.

    I think that if I'll continue to be forced to "work" in C# I'll end up wrapping the real Perl regexps in a .Net class whose design might not be so "clean OO", but will be easier to use. Like I did with VB.

    Jenda
    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson

      Shame on me 'cause I have forgot to thanks you Jenda!.

      Thanks for all the time you have shared your magic with me, like your funny _b_a_c_k_u_p utility, and with other monks with your inhestimable site-repository.

      cheers from roma Lor*

      PS see you on www.C#monks.org ;)

      Each to their own taste, but here's the contrast -

      # perl s{%(\w+)%}{$hash{$1}}g // C# Regex.Replace(s, @"%(\w+)%", new MatchEvaluator( hashLookup ) );

       

        Where's the hashLookup() defined? The Perl code was complete, the C# is far from complete.

        Jenda
        We'd like to help you learn to help yourself
        Look around you, all you see are sympathetic eyes
        Stroll around the grounds until you feel at home
           -- P. Simon in Mrs. Robinson

Re^2: Murder of a Perl coder (announced)
by Discipulus (Abbot) on Oct 15, 2004 at 07:49 UTC
    Thanks EdwardG!

    thank you for your suggestion about C# regEX, may be it will be a good point to start having fun with SeaShark, and most important thanks for your sympathy

    cheers from roma Lor*

    PS see you on www.C#monks.org ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://398852]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2020-10-24 12:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (243 votes). Check out past polls.

    Notices?