<?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 script - piping problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282792#M641245</link>
    <description>Yes it was the new line character. Thanks&lt;BR /&gt;Now what should I do to get rid of the error below ?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;open (MYFILE,'/ip/a.txt');&lt;BR /&gt; while (&lt;MYFILE&gt;){&lt;BR /&gt;  $net = "$_"; #$net = "2.24.0.0/13"&lt;BR /&gt;  &lt;BR /&gt;  chomp($net);&lt;BR /&gt;  my @args = ( "ipcalc ", $net, "|","grep Wildcard|awk '{print \$2}' \&amp;gt;&amp;gt; /ip/b.txt" );&lt;BR /&gt;  $cmd = @args[0].@args[1].@args[2].@args[3];&lt;BR /&gt;  system ($cmd);&lt;BR /&gt;  print "$cmd\n";&lt;BR /&gt; }&lt;BR /&gt;close (MYFILE);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Use of uninitialized value $ENV{"TERM"} in pattern match (m//) at /usr/bin/ipcalc line 714.&lt;BR /&gt;ipcalc 83.223.192.0/19|grep Wildcard|awk '{print $2}' &amp;gt;&amp;gt; /ip/b.txt&lt;/MYFILE&gt;</description>
    <pubDate>Mon, 23 May 2011 12:59:06 GMT</pubDate>
    <dc:creator>Piotr Kirklewski</dc:creator>
    <dc:date>2011-05-23T12:59:06Z</dc:date>
    <item>
      <title>Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282790#M641243</link>
      <description>Hi there&lt;BR /&gt;&lt;BR /&gt;my @args = ( "ipcalc ", $net, "|","grep Wildcard" );&lt;BR /&gt;system (@args);&lt;BR /&gt;&lt;BR /&gt;Why am i getting this:&lt;BR /&gt;&lt;BR /&gt;ipcalc 2.1.2.0/20&lt;BR /&gt;|grep Wildcard&lt;BR /&gt;&lt;BR /&gt;Rather then this:&lt;BR /&gt;&lt;BR /&gt;ipcalc 2.1.2.0/20 |grep Wildcard&lt;BR /&gt;&lt;BR /&gt;?&lt;BR /&gt;</description>
      <pubDate>Mon, 23 May 2011 01:40:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282790#M641243</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-23T01:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282791#M641244</link>
      <description>Your $net variable probably contains a newline character at the end.&lt;BR /&gt;&lt;BR /&gt;Use "chomp ($net);" to remove it.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Mon, 23 May 2011 04:30:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282791#M641244</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2011-05-23T04:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282792#M641245</link>
      <description>Yes it was the new line character. Thanks&lt;BR /&gt;Now what should I do to get rid of the error below ?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;open (MYFILE,'/ip/a.txt');&lt;BR /&gt; while (&lt;MYFILE&gt;){&lt;BR /&gt;  $net = "$_"; #$net = "2.24.0.0/13"&lt;BR /&gt;  &lt;BR /&gt;  chomp($net);&lt;BR /&gt;  my @args = ( "ipcalc ", $net, "|","grep Wildcard|awk '{print \$2}' \&amp;gt;&amp;gt; /ip/b.txt" );&lt;BR /&gt;  $cmd = @args[0].@args[1].@args[2].@args[3];&lt;BR /&gt;  system ($cmd);&lt;BR /&gt;  print "$cmd\n";&lt;BR /&gt; }&lt;BR /&gt;close (MYFILE);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Use of uninitialized value $ENV{"TERM"} in pattern match (m//) at /usr/bin/ipcalc line 714.&lt;BR /&gt;ipcalc 83.223.192.0/19|grep Wildcard|awk '{print $2}' &amp;gt;&amp;gt; /ip/b.txt&lt;/MYFILE&gt;</description>
      <pubDate>Mon, 23 May 2011 12:59:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282792#M641245</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-23T12:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282793#M641246</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Now what should I do to get rid of the error below ?&lt;BR /&gt;&lt;BR /&gt;Use of uninitialized value $ENV{"TERM"} in pattern match (m//) at /usr/bin/ipcalc line 714.&lt;BR /&gt;ipcalc 83.223.192.0/19|grep Wildcard|awk '{print $2}' &amp;gt;&amp;gt; /ip/b.txt&lt;BR /&gt;&lt;BR /&gt;The environmental 'TERM' variable isn't set.  Either set it before you run your script, or (better) test for "defined-ness" before referencing it.  This will need to be done in '/ipcalc' --- the code for which you don't show.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 23 May 2011 13:15:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282793#M641246</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-23T13:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282794#M641247</link>
      <description>But ipcalc is a Liux utility.</description>
      <pubDate>Mon, 23 May 2011 13:35:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282794#M641247</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-23T13:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282795#M641248</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; But ipcalc is a Linux utility.&lt;BR /&gt;&lt;BR /&gt;Then set the TERM variable to something in your script or on the command line!&lt;BR /&gt;&lt;BR /&gt;# TERM=vt100 ./Piotr_Script&lt;BR /&gt;&lt;BR /&gt;...Notice that there is whitespace after the setting without any semicolon before the run of your script.  That sets the environmental variable only for the duration of your script.&lt;BR /&gt;&lt;BR /&gt;Otherwise in your script do something like this shows:&lt;BR /&gt;&lt;BR /&gt;# perl -le 'local $ENV{TERM}='vt100';print "[$ENV{TERM}]"'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 23 May 2011 13:59:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282795#M641248</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-23T13:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282796#M641249</link>
      <description>Piotr:&lt;BR /&gt;&lt;BR /&gt;Did this solve your problem?&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 23 May 2011 17:10:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282796#M641249</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-23T17:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282797#M641250</link>
      <description>Yes&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 23 May 2011 21:47:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282797#M641250</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-23T21:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282798#M641251</link>
      <description>One more question.&lt;BR /&gt;How do I get the output of $cmd to a perl variable.&lt;BR /&gt;&lt;BR /&gt;$var = $cmd doesn't work.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;system ("TERM=vt100");&lt;BR /&gt;local $ENV{TERM}='vt100';&lt;BR /&gt;#print "[$ENV{TERM}]"';&lt;BR /&gt;open (MYFILE,'/ip/a.txt');&lt;BR /&gt; while (&lt;MYFILE&gt;){&lt;BR /&gt;  $net = "$_"; #$net = "2.24.0.0/13"&lt;BR /&gt;  &lt;BR /&gt;  chomp($net);&lt;BR /&gt;  my @args = ( "ipcalc ", $net, "|","grep Wildcard|awk '{print \$2}' \&amp;gt;&amp;gt; /ip/b.txt" );&lt;BR /&gt;  $cmd = @args[0].@args[1].@args[2].@args[3];&lt;BR /&gt;  system ($cmd);&lt;BR /&gt; }&lt;BR /&gt;close (MYFILE);&lt;/MYFILE&gt;</description>
      <pubDate>Mon, 23 May 2011 22:40:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282798#M641251</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-23T22:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282799#M641252</link>
      <description>Hi (again) Piotr:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; How do I get the output of $cmd to a perl variable.&lt;BR /&gt;&lt;BR /&gt;The simplest way, when you don't care about the return code is to use backticks:&lt;BR /&gt;&lt;BR /&gt;# perl -le '$result=`uname -a`;print $result'&lt;BR /&gt;&lt;BR /&gt;If you dislike the backticks use 'qx( .... )':&lt;BR /&gt;&lt;BR /&gt;# perl -le 'perl -le '$result=qx(uname -a);print $result'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 23 May 2011 22:53:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282799#M641252</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-23T22:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script - piping problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282800#M641253</link>
      <description>closed</description>
      <pubDate>Mon, 23 May 2011 23:50:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-piping-problem/m-p/5282800#M641253</guid>
      <dc:creator>Piotr Kirklewski</dc:creator>
      <dc:date>2011-05-23T23:50:18Z</dc:date>
    </item>
  </channel>
</rss>

