pray help a poor wanderer with syntax
I am populating a table with some statistics, e.g.
$tables{$day}->{$state} = \[$deathsToday, $m, $double, $intercept,
+ $corr];
These are grouped in my mind as an array, so that's why I used the anonymous array above. So then it gets used later, viz
foreach my $point ( @${$tables{$day}->{$state}} ) {
print $fh "\t", $point;
After time, I want to add a feature, for which I need to access just the first element. It seems like it should be something like
${$tables{$day}->{confirmed}}[0]; but that isn't right.
dump $tables{$day} helpfully offers
{
confirmed => \[1, 0.334638642561918, 2, 0.873307778517249, 0.8539438
+57158699],
deaths => \[],
}
(This is a covid visualization thing.)
I could of course convert that five element array to a hash (and actually, just because it comes back from a linear regression as an array doesn't mean it has to stay that way) but I'd like to understand the syntax. Pray, give insight to this lost soul?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.