Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
laziness, impatience, and hubris
 
PerlMonks  

Re: Best practice or cargo cult?

by starbolin (Hermit)
on Jun 20, 2006 at 16:43 UTC ( [id://556524]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Best practice or cargo cult?

The problem with "Thou Shalt"s in programing ( and enginering in general ) is that someone is always advocating a colliding list of "Thou Shalt"s.

From perlretut:

You might wonder why '.' matches everything but "\n" - why not every character? The reason is that often one is matching against lines and would like to ignore the newline characters.
Obviously Mark and Damian are coming at it from different perspectives. Probably based on the type of problem sets they work on. As perlretut points out, the two switches /s and /m create a total of four different behaviors. Each may suit a diffent class of problem.

As to the use of /x, it only does one good if one actually comments one's code. Thanks to this thread I now have the ugly vision of seeing some SOPW's code sprinkled with m/../x but without any comments!

And let me just remined everyone, in a little bit of advice a boss onced passed on to me:

"Fortran 7 is the only real computer language."


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^2: Best practice or cargo cult?
by strat (Canon) on Jun 21, 2006 at 04:41 UTC

    If my RE is too long for a single line but rather simple, I just use /x without a comment within the RE (maybe there's one before, e.g

    # replace all <a href="link"...>linktext</a> # with [url="link"]linktext[/url] $var =~ s~<a \s+ href = "([^"]+)" [^>]* > (.+?) </a> ~\[url="$1"\]$2\[/url\]~gsx;

    (Well, I know there are better ways to parse html than with REs, but it was the first example that came into my mind)

    I only use g, s, m when really needed and not as default options.

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://556524]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.