Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: You can't assign $_ to a hash in a foreach statement

by cavac (Parson)
on Apr 11, 2022 at 07:01 UTC ( [id://11142910]=note: print w/replies, xml ) Need Help??


in reply to You can't assign $_ to a hash in a foreach statement

On a sidenote, using the implicit $_ variable make your code harder to read and harder to maintain. You have to consider every statement carefully and think about if it has the side effect of changing or using $_. This can be especially time consuming if you change the code sometime in the future and it suddenly breaks.

If you always use names variables, it makes it much easier to follow the data flow and see what is assigned to what variable.

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-19 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found