Gossamer Forum
Home : General : Perl Programming :

Re: [delicia] another perl question

Quote Reply
Re: [delicia] another perl question In reply to
Here it is with some extra debug in:

Code:
use File::Slurp;

print "Content-Type: text/html \n\n";

# read it into a variable
my $file = read_file($configfile);

print qq|Reading: $file \n<br>|;

my $values;
my %new_hash;
# grab the value back using a regex
$file =~ m/\%db_select_fields = \((.*?)\)/s and $values = $1;

print qq|GOT: $values \n\n<br><br>|;

# loop through the grabbed values, line by line - and the tweak and pass into a new variable
foreach (split /\n/, $values) {
my @tmp = split /\Q => /, $_;
$tmp[0] =~ s/^'|'$//g;
$tmp[1] =~ s/^'|',?$//g;
print qq|Adding: $tmp[0] ==> $tmp[1]\n<br>|;
$new_hash{$tmp[0]} = $tmp[1];
}

use Data::Dumper;
print qq|Now values:|;
print Dumper(%new_hash);

# values are not in %new_hash

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread; hot thread another perl question delicia 20882 Sep 6, 2016, 1:58 PM
Thread; hot thread Re: [delicia] another perl question
Andy 20379 Sep 6, 2016, 11:39 PM
Thread; hot thread Re: [Andy] another perl question
delicia 20363 Sep 7, 2016, 8:41 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20365 Sep 7, 2016, 8:46 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20406 Sep 7, 2016, 8:58 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20358 Sep 7, 2016, 9:01 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20398 Sep 7, 2016, 9:10 AM
Post; hot thread Re: [delicia] another perl question
Andy 20377 Sep 7, 2016, 9:22 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20389 Sep 7, 2016, 9:04 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20341 Sep 7, 2016, 9:20 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20332 Sep 7, 2016, 9:24 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20348 Sep 7, 2016, 9:32 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20320 Sep 7, 2016, 9:36 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20361 Sep 7, 2016, 9:46 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20319 Sep 7, 2016, 10:27 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20318 Sep 7, 2016, 10:56 AM
Post; hot thread Re: [delicia] another perl question
Andy 20333 Sep 7, 2016, 11:04 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20342 Sep 7, 2016, 11:10 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20335 Sep 7, 2016, 11:17 AM
Thread; hot thread Re: [delicia] another perl question
delicia 20361 Sep 7, 2016, 11:19 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20301 Sep 7, 2016, 11:24 AM
Thread; hot thread Re: [Andy] another perl question
delicia 20281 Sep 7, 2016, 12:04 PM
Thread; hot thread Re: [delicia] another perl question
Andy 20294 Sep 7, 2016, 12:06 PM
Thread; hot thread Re: [Andy] another perl question
delicia 5423 Sep 7, 2016, 12:09 PM
Post; hot thread Re: [delicia] another perl question
delicia 5474 Sep 7, 2016, 1:17 PM
Thread; hot thread Re: [delicia] another perl question
Andy 5460 Sep 7, 2016, 11:06 PM
Thread; hot thread Re: [Andy] another perl question
delicia 5452 Sep 8, 2016, 7:05 AM
Thread; hot thread Re: [delicia] another perl question
Andy 5450 Sep 8, 2016, 7:26 AM
Thread; hot thread Re: [Andy] another perl question
delicia 5445 Sep 8, 2016, 7:43 AM
Post; hot thread Re: [delicia] another perl question
Andy 5437 Sep 8, 2016, 7:47 AM
Thread; hot thread Re: [delicia] another perl question
Andy 20302 Sep 7, 2016, 11:21 AM
Post; hot thread Re: [Andy] another perl question
delicia 20300 Sep 7, 2016, 11:23 AM