Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How to avoid $_ in grep

by blahblahblah (Priest)
on Nov 14, 2007 at 03:06 UTC ( #650660=note: print w/ replies, xml ) Need Help??


in reply to How to avoid $_ in grep

I feel that all of the above suggestions, though good, missed your original point: "I do scripts for biologists ... and they always get lost with $_." If biologists can't understand $_, then keep your code simple for them. Don't use $_, and while you're at it avoid map & grep. It's not that much harder to write out a loop, but it can make a world of difference to someone who is only a novice in perl.

Joe


Comment on Re: How to avoid $_ in grep
Re^2: How to avoid $_ in grep
by Krambambuli (Deacon) on Nov 14, 2007 at 09:39 UTC
    I'd agree with the above; also, maybe it is possible to put a thicker line between things that 'custom users' need or are allowed to change ?
    Maybe offering a distinct Config file, or separating the allowed/easy to change code in front of the scripts or even distinct modules ?

    If the users are really meant to tamper the very hearth of underlying algorithms and so, $_ would probably be the smallest difficulty to overcome.

    Maybe you can do yet another thing, as I'm just learning from the book I mention in the signature below:
    can you offer them some placeholder subs and use callbacks, so that they could easily manage their own particular code snippets within the otherwise bigger code machinery ?

    Krambambuli
    ---
    enjoying Mark Jason Dominus' Higher-Order Perl
Re^2: How to avoid $_ in grep
by felipe (Initiate) on Nov 14, 2007 at 14:27 UTC
    Thanks all for your replies. I have to say that, although blahblahblah didn't give me the solution I was looking for, he understood me perfectly and he came up with a nice solution. Thanks all. Problem solved: I won't use grep.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2015-07-06 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls