Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Need advice for perl use as awk replacement

by Anonymous Monk
on Sep 21, 2020 at 21:54 UTC ( #11122044=note: print w/replies, xml ) Need Help??


in reply to Re: Need advice for perl use as awk replacement
in thread Need advice in for perl use as awk replacement

Thanks, me storing references is very interesting. At first I did not see exectely where your code does difeer to mine in that point, simply because I did not know the perl reference/value syntax. I was expecting a python like approach, but was wrong.

The interesting thing is that my script has \$1 .... which if I understand correctly would be references for python, but actually I user double quotes in th ebash script which requires me to pu \$1 to avoid $1 to be replaced by the shell. This I expect perl to see "$1,$2,$3..." without backslash, eg. value. Am I wrong here ?

The reason I use double quotes is that later thea ctual additional filtering conditions will be injected via shell variable depending on the bash function call arguments.

But I realize that actually my variable name for th earray "$m" was wrong and should be "@m". Cannot try now, but will give it a try tomorrow.

  • Comment on Re^2: Need advice for perl use as awk replacement

Replies are listed 'Best First'.
Re^3: Need advice for perl use as awk replacement
by hippo (Chancellor) on Sep 22, 2020 at 08:34 UTC
    actually I user double quotes in th ebash script which requires me to pu \$1 to avoid $1 to be replaced by the shell

    Ah yes, you are quite right. I have to agree with brother jcb that using a one-liner for this, especially with double quotes, is just asking for trouble and will be a maintenance nightmare. Just put it all in a script and then you won't have to worry about escaping everything. Eventually, when you become more familiar with Perl and what it can do you may see the benefit in replacing all of the bash parts with Perl.

    There's a place for one-liners but this doesn't look like that place to me.


    🦛

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2020-10-20 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?