Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: You can't assign $_ to a hash in a foreach statementby cavac (Parson) |
on Apr 11, 2022 at 07:01 UTC ( [id://11142910]=note: print w/replies, xml ) | Need Help?? |
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";'
In Section
Seekers of Perl Wisdom
|
|