<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: perl query in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857183#M98223</link>
    <description>Hi Steve:&lt;BR /&gt;&lt;BR /&gt;Yes, one or more of the elements is the array passed is undefined.  Consider:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;sub insert_audit&lt;BR /&gt;{&lt;BR /&gt;  my (@record)=(@_);&lt;BR /&gt;  print "@record\n";&lt;BR /&gt;  print "$record[1]\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;insert_audit ("a", "b"  , "c");&lt;BR /&gt;print "------\n";&lt;BR /&gt;insert_audit ("a", undef, "c");&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;If you run that you will see:&lt;BR /&gt;&lt;BR /&gt;a b c&lt;BR /&gt;b&lt;BR /&gt;------&lt;BR /&gt;Use of uninitialized value in join or string at /tmp/subs line 8.&lt;BR /&gt;a  c&lt;BR /&gt;Use of uninitialized value in concatenation (.) or string at /tmp/subs line 9.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 05 Sep 2006 15:15:37 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-09-05T15:15:37Z</dc:date>
    <item>
      <title>perl query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857182#M98222</link>
      <description>Hi everyone&lt;BR /&gt;&lt;BR /&gt;I am trying to pass the the following into a sub routine&lt;BR /&gt;&lt;BR /&gt;&amp;amp;insert_audit("$hostid successfully $hostname");&lt;BR /&gt;&lt;BR /&gt;the subroutine is used to pass the data into a MySQL database via perl::DBD module. I appear to have a problem though when trying to create an array from the pass to the sub routine&lt;BR /&gt;&lt;BR /&gt;sub insert_audit ()&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;my (@record)=shift (@_);&lt;BR /&gt;print "@record\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;The above is ok, ie (1 line of output below)&lt;BR /&gt;&lt;BR /&gt;48 successfully rs-demo8&lt;BR /&gt;&lt;BR /&gt;If I try to print an element of the array. The statement is as follows&lt;BR /&gt;&lt;BR /&gt;sub insert_audit ()&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;my (@record)=(@_);&lt;BR /&gt;print "@record\n";&lt;BR /&gt;print "$record[1]";&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Use of uninitialized value in join or string at configUpload.pl line 49&lt;BR /&gt;&lt;BR /&gt;Which suggests the attempt to create the array from the parameters passed to the sub routine fails ?&lt;BR /&gt;&lt;BR /&gt;Am I doing something wrong ?&lt;BR /&gt;&lt;BR /&gt;TIA&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Tue, 05 Sep 2006 15:00:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857182#M98222</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-05T15:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: perl query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857183#M98223</link>
      <description>Hi Steve:&lt;BR /&gt;&lt;BR /&gt;Yes, one or more of the elements is the array passed is undefined.  Consider:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;sub insert_audit&lt;BR /&gt;{&lt;BR /&gt;  my (@record)=(@_);&lt;BR /&gt;  print "@record\n";&lt;BR /&gt;  print "$record[1]\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;insert_audit ("a", "b"  , "c");&lt;BR /&gt;print "------\n";&lt;BR /&gt;insert_audit ("a", undef, "c");&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;If you run that you will see:&lt;BR /&gt;&lt;BR /&gt;a b c&lt;BR /&gt;b&lt;BR /&gt;------&lt;BR /&gt;Use of uninitialized value in join or string at /tmp/subs line 8.&lt;BR /&gt;a  c&lt;BR /&gt;Use of uninitialized value in concatenation (.) or string at /tmp/subs line 9.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 05 Sep 2006 15:15:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857183#M98223</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-05T15:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: perl query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857184#M98224</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;I understand your description and why I would see this error. I can't however see why in this example I get the error. When I print the array as a whole&lt;BR /&gt;&lt;BR /&gt;print "@record\n";&lt;BR /&gt;&lt;BR /&gt;I get each element that I have passed, ie&lt;BR /&gt;&lt;BR /&gt;&amp;amp;insert_audit("$hostid successfully $hostname");&lt;BR /&gt;&lt;BR /&gt;gives&lt;BR /&gt;&lt;BR /&gt;49 successfully rs-dev&lt;BR /&gt;&lt;BR /&gt;Am I being a little thick here ?&lt;BR /&gt;&lt;BR /&gt;TIA&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Tue, 05 Sep 2006 15:33:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857184#M98224</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-05T15:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: perl query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857185#M98225</link>
      <description>Interesting&lt;BR /&gt;&lt;BR /&gt;my $sum=@record;&lt;BR /&gt;print "$sum\n";&lt;BR /&gt;&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Tue, 05 Sep 2006 15:39:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857185#M98225</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-05T15:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: perl query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857186#M98226</link>
      <description>Hi Steve:&lt;BR /&gt;&lt;BR /&gt;OK, you passed a scalar, not an array or list when you said:&lt;BR /&gt;&lt;BR /&gt;# insert_audit("$hostid successfully $hostname");&lt;BR /&gt;&lt;BR /&gt;You should do:&lt;BR /&gt;&lt;BR /&gt;# insert_audit (($hostid, "successfully",$hostname));&lt;BR /&gt;&lt;BR /&gt;Thus:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;use diagnostics;&lt;BR /&gt;&lt;BR /&gt;sub insert_audit&lt;BR /&gt;{&lt;BR /&gt;  my (@record)=(@_);&lt;BR /&gt;  print "@record\n";&lt;BR /&gt;  print "$record[1]\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;my $hostid   = 48;&lt;BR /&gt;my $hostname = "myhost";&lt;BR /&gt;insert_audit ( ($hostid, "successfully", $hostname) );&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;...yields:&lt;BR /&gt;&lt;BR /&gt;48 successfully myhost&lt;BR /&gt;successfully&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Sep 2006 15:46:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857186#M98226</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-05T15:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: perl query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857187#M98227</link>
      <description>Bargain !!&lt;BR /&gt;&lt;BR /&gt;I get it, &lt;BR /&gt;&lt;BR /&gt;Thanks James&lt;BR /&gt;&lt;BR /&gt;In the meantime I came to this&lt;BR /&gt;&lt;BR /&gt;my ($hostid, $exit, $hostname);&lt;BR /&gt;my ($record)=(@_);&lt;BR /&gt;($hostid, $exit, $hostname)=split(/ /, $record);&lt;BR /&gt;&lt;BR /&gt;Will do it your way as that is correct&lt;BR /&gt;&lt;BR /&gt;Thanks again&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Tue, 05 Sep 2006 15:53:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-query/m-p/3857187#M98227</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-05T15:53:33Z</dc:date>
    </item>
  </channel>
</rss>

