http://www.perlmonks.org?node_id=11154362


in reply to Re: A good way to input data into a script w/o an SQL database
in thread A good way to input data into a script w/o an SQL database

I was just thinking of a way to input the data into an array of hashes from one or more external files which would hold the data. The array is then used to provide some simple configuration options to a program. This script is intended to run both Linux and Windows, obviously changing the paths.

#!/usr/bin/env perl use strict; use warnings; use autodie; # For Windows my $Subscriptions_Path = "G:/Subscriptions"; my $Phone_Sync = "G:/Sync/PHONE/Main/Music"; my $Temp_Files_Location = "G:/Subscriptions/tmp"; my $Wait_Time = 10; # Subscription DATA sets my @Subscription = ( { Sub_Name => "Morph", Archive_File => "Morph Archive.txt", Lib_Sub_Path => "$Subscriptions_Path/Morph", Phone_transfer => 0 }, ); for (@Subscription) { print "Beginning Subscription Service for $_->{Sub_Name} \n"; print "\nCompleting Subscription Service for $_->{Sub_Name} \n\n\ +n"; sleep int(rand($Wait_Time)); }