I initially tried a hash and got the same type of error. I then rewrote the code to work with tables and it still did not work. I would rather use hashes. Can someone please show me why I am getting the error and hopefully the syntax to correct it. If I ignore the error then the hash table has the incorrect entries. The error I received was: Can't use string ("Wed") as a HASH ref while "strict refs" in use at test3.pl line 51, My input file was:

lmutil - Copyright (c) 1989-2009 Flexera Software, Inc. All Rights Res +erved. Flexible License Manager status on Wed 1/2/2019 07:00 [Detecting lmgrd processes...] License server status: 27000@unodecx80 License file(s) on unodecx80: E:\Program Files (x86)\IBM\RationalR +LKS\common\rational_server_perm.dat:E:\Program Files (x86)\IBM\Ration +alRLKS\common\rational_server_temp.dat: unodecx80: license server UP (MASTER) v11.10 Vendor daemon status (on unodecx80): ibmratl: UP v11.10 Feature usage info: Users of ClearCase: (Total of 10 licenses issued; Total of 1 license + in use) "ClearCase" v1.00000, vendor: rational floating license amlove unodecx86 WI_zfTVVG-n7Ph2jhkOo #u#amlove#u# (v1.0) (unodecx +80/27000 615), start Wed 1/2 6:56 (linger: 1800) Users of ADALangPack: (Total of 1 license issued; Total of 0 license +s in use) The following was my code: #!/usr/bin/perl use strict; use warnings; my $mydebug1=1; my $val="X"; my $k1=""; my $k2=""; my $k3=""; my $k4=""; my %metrics = (); my $sysacc=""; my $origsys=""; my $product=""; my $day=""; my $date=""; my $hour=""; my $skip=1; my $user=""; my $dum1=""; my $dum2=""; my $dum3=""; my $dum4=""; my $dum5=""; my $dum6=""; my $dum7=""; my $cnt=0; my $found=0; my $checkval="Users of"; my $str = ""; open (LICIN, "<C:\\SCCI\\scci_clearcase\\All_license_info_Jan2019_samp +le\.txt"); while ($str = <LICIN>) { chomp $str; if ($str =~ /^Flexible License/) { ($dum1,$dum2,$dum3,$dum4,$dum5,$day,$date,$dum6) = split(/ /,$ +str,8); ($hour,$dum1) = split(/:/,$dum6,2); next; } if ($str =~ /$checkval/) { if ($str =~ /Users of ClearCase/) { $str = <LICIN>; $str = <LICIN>; $str = <LICIN>; $str = <LICIN>; while ($str = <LICIN>) { chomp $str; last if ($str eq ""); $str =~ s/^\s+//; ($user,$sysacc,$origsys,$dum1) = split(/ /,$str,4); $product="ClearCase"; $metrics{$product}{$date} = $day; $metrics{$product}{$date}{$hour}{$user} = $val; } } next; } } # # print hash table # if ($mydebug1) { for $k1 (keys (%metrics)) { print "k1 = $k1 \n"; for $k2 (keys(%{ $metrics{$k1} })) { print "k2 = $k2 \n"; for $k3 (keys(%{ $metrics{$k1}{$k2} })) { print "k3 = $k3 \n"; for $k4 (keys(%{ $metrics{$k1}{$k2}{$k3} })) { print "k4 = $k4 \t k4val = $metrics{$k1}{$k2}{$k3} +{$k4}\n"; } } } } }

In reply to Re^2: Why am I getting Can't use string (<string value>) as an ARRAY ref wile "strict refs" in use by 5NOMAD7
in thread Why am I getting Can't use string (<string value>) as an ARRAY ref wile "strict refs" in use by 5NOMAD7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.