Gossamer Forum
Quote Reply
Global with arrays
I have a field "Prices"; there i save something like:

1|300,1.5|450,2|600

Now i want to split it with

@a = split(/,/,$t->{Prices});

I should have now something like:

$a[0] = 1|300
$a[1] = 1.5|450
$a[2] = 2|600

Now i walk tru with:

while (my ($key, $value) = each @a) {
@b = split(/\|/,$value);
}

Now i should have:

$a[1] = 300
$a[1.5] = 450
$a[2] = 600

again i want to walk tru:

while (my ($key, $value) = each @b) {
$output .= "For $key pieces you pay $value Dollar";
}

I got:

Unable to compile 'Rates': Type of arg 1 to each must be hash (not private array) at (eval 117) line 8, near "@a) " Type of arg 1 to each must be hash (not private array) at (eval 117) line 12, near "@b) "

and i have no idea what i should do now.
Subject Author Views Date
Thread Global with arrays Robert 3654 Sep 1, 2016, 6:57 AM
Thread Re: [Robert] Global with arrays
Andy 3545 Sep 1, 2016, 12:24 PM
Post Re: [Andy] Global with arrays
Robert 3512 Sep 1, 2016, 1:50 PM