This is a perl script that can read hashes into memory using txt files.
- Create a txt file in the
files_to_process
directory. Start an object with==
. - In order to create key-value pairs, simple type it as
key: value
- Repeat for as many key-value pairs as your like. Here is an example.
==
Name: Doris Peaver
Race: Elf
Background: Totem Carver
Description: An elf who speaks very little.
/==
This text will be ignored
==
Name: Jackson
Race: human
Background: Shepard
Description: A man that looks after sheep and occasionally attempts to act bravely in battle.
/==
- End the object with
/==
- repeat steps 2-3 until you have create all your objects.
- run the script using
perl object_reader.pl
- The script will print your hashmaps to the console.
This script is designed to work within your devOps pipeline so that you can use this very simple format with txt files and transfer them to JSON or other useful formats. You can also change what kind of files are read by changing my $type
to a different format. Currently there are two sample files in the "files_to_process" folder. You may add as many files as you like.
Some minor further coding will need to be done to accept multiple file formats.