in reply to Store and print multiple strings
I'm having a bit of difficulty figuring out what you're asking, but if I understand correctly, you expect the second part of your output to look like:
$VAR1 = { '200' => [ '~0.00', '~0.00', '~0.00', '~0.00', '~0.00', '~0.00' ], '199' => [ '~0.00', '~0.00', '~0.00', '~0.00', '~0.00', '~0.00' ], };
If I've guessed correctly, then the problem is that you're assigning an array to a scalar in this line:
$lag_load{$lag_traffic} = @lag_util;
and the way to fix it is to create an array reference, and put that into the hash like this:
$lag_load{$lag_traffic} = [ @lag_util ];
You might consider tuning up your question a bit, in order to make it more accurate, and easier to see what you're asking. Your code doesn't show how you're printing your values out, and it doesn't look like it could possibly give you the results you've shown because the match expression doesn't capture the tilde character (~). You didn't show what you expected to see, either, so I'm reduced to making a guess.
Update: Struck out incorrect statement, as AnomalousMonk pointed out that the regex actually does capture the tilde (because I didn't read the regex carefully enough, I overlooked the '.').
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Store and print multiple strings
by AnomalousMonk (Archbishop) on Mar 12, 2018 at 14:15 UTC | |
|
Re^2: Store and print multiple strings
by bartrad (Beadle) on Mar 12, 2018 at 14:16 UTC | |
by AnomalousMonk (Archbishop) on Mar 12, 2018 at 15:02 UTC | |
by roboticus (Chancellor) on Mar 12, 2018 at 15:36 UTC | |
|
Re^2: Store and print multiple strings
by Anonymous Monk on Mar 12, 2018 at 13:46 UTC | |
by roboticus (Chancellor) on Mar 12, 2018 at 13:55 UTC |