|
|
| Just another Perl shrine | |
| PerlMonks |
Problem Declaring a hashby The_Evil_One (Initiate) |
| on Nov 05, 2025 at 19:39 UTC ( [id://11166654]=perlquestion: print w/replies, xml ) | Need Help?? |
|
The_Evil_One has asked for the wisdom of the Perl Monks concerning the following question: I am learning Perl using a book downloaded from the internet. Opal is a system for charging fares on public transport in NSW Australia. I have had four Opal cards and they identified by 16 digit numbers. I have four target directories into which the files related to these cards go and I have tried to set up a hash to map between card numbers and the destination directories but it does not work and the error messages make no sense to me. This is the current form of the hash definition which is at line 26 in the script:-
I am writing a small program to copy Opal related files from my downloads directory to the appropriate destination directories. Basically it tells me that I am trying to assign a scalar value to the % sign representing the modulus operator which cannot receive such a value but the % sign is to mark the variable as being a hash. I have tried various changes on the definition, originally I had both keys and values in double quotes now I have the values in single quotes, originally I used commas to separate key value pairs. No matter what I change the error messages remain the same. It may be that the book I downloaded is old and some syntax suggested in the book no longer works but no matter how many queries I have put into Google and how many AI overviews I have seen and hit list links that I have followed nothing has confirmed this.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||