<?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 read in line to variable in script in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/perl-read-in-line-to-variable-in-script/m-p/4637398#M39996</link>
    <description>Whoops forgot EOR in file, but I still cannot get it to work...&lt;BR /&gt;--------------------------&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;open IN, "&lt;TN.LOAD&gt;&lt;/TN.LOAD&gt;open OUT, "&amp;gt;out.txt";&lt;BR /&gt;open AC_OUT, "&amp;gt;AC_BULK_out.txt";&lt;BR /&gt;open ERR, "&amp;gt;err.txt";&lt;BR /&gt;&lt;BR /&gt;print AC_OUT".LOG YES\n\n";&lt;BR /&gt;&lt;BR /&gt;while(&lt;IN&gt;) {&lt;BR /&gt;print OUT "$tn\n";&lt;BR /&gt;print AC_OUT &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;BR /&gt;UPDATE/$tn,,,&lt;BR /&gt;.INSERT FEATURES&lt;BR /&gt;QUANTITY/1&lt;BR /&gt;FEATURE/VMP OCTEL&lt;BR /&gt;.END_INSERT&lt;BR /&gt;.EOR&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;close IN, OUT, AC_OUT, ERR;&lt;/IN&gt;</description>
    <pubDate>Tue, 25 May 2010 20:08:49 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2010-05-25T20:08:49Z</dc:date>
    <item>
      <title>Perl read in line to variable in script</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-read-in-line-to-variable-in-script/m-p/4637397#M39995</link>
      <description>I have a file with one entry on each line.&lt;BR /&gt;I want to read it into perl, and insert in a variable.&lt;BR /&gt;&lt;BR /&gt;So the output will look like:&lt;BR /&gt;.BEGIN&lt;BR /&gt;UPDATE/2045555555,,,&lt;BR /&gt; .INSERT FEATURES&lt;BR /&gt;         QUANTITY/1&lt;BR /&gt;         FEATURE/VMP OCTEL &lt;BR /&gt;      .END_INSERT&lt;BR /&gt;.EOR&lt;BR /&gt;&lt;BR /&gt;.BEGIN&lt;BR /&gt;UPDATE/2045555555,,,&lt;BR /&gt; .INSERT FEATURES&lt;BR /&gt;         QUANTITY/1&lt;BR /&gt;         FEATURE/VMP OCTEL &lt;BR /&gt;      .END_INSERT&lt;BR /&gt;.EOR&lt;BR /&gt;&lt;BR /&gt;Yada, yada&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;open IN, "&lt;TN.LOAD&gt;&lt;/TN.LOAD&gt;open OUT, "&amp;gt;out.txt";&lt;BR /&gt;open AC_OUT, "&amp;gt;AC_BULK_out.txt";&lt;BR /&gt;open ERR, "&amp;gt;err.txt";&lt;BR /&gt;&lt;BR /&gt;print AC_OUT".LOG YES\n\n";&lt;BR /&gt;&lt;BR /&gt;while(&lt;IN&gt;) {&lt;BR /&gt;        print OUT "$tn\n";&lt;BR /&gt;        print AC_OUT &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;BR /&gt;UPDATE/$tn,,,&lt;BR /&gt; .INSERT FEATURES&lt;BR /&gt;         QUANTITY/1&lt;BR /&gt;         FEATURE/VMP OCTEL &lt;BR /&gt;      .END_INSERT&lt;BR /&gt;.EOR&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt; close IN, OUT, AC_OUT, ERR;&lt;/IN&gt;</description>
      <pubDate>Tue, 25 May 2010 19:50:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-read-in-line-to-variable-in-script/m-p/4637397#M39995</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2010-05-25T19:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Perl read in line to variable in script</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-read-in-line-to-variable-in-script/m-p/4637398#M39996</link>
      <description>Whoops forgot EOR in file, but I still cannot get it to work...&lt;BR /&gt;--------------------------&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;open IN, "&lt;TN.LOAD&gt;&lt;/TN.LOAD&gt;open OUT, "&amp;gt;out.txt";&lt;BR /&gt;open AC_OUT, "&amp;gt;AC_BULK_out.txt";&lt;BR /&gt;open ERR, "&amp;gt;err.txt";&lt;BR /&gt;&lt;BR /&gt;print AC_OUT".LOG YES\n\n";&lt;BR /&gt;&lt;BR /&gt;while(&lt;IN&gt;) {&lt;BR /&gt;print OUT "$tn\n";&lt;BR /&gt;print AC_OUT &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;BR /&gt;UPDATE/$tn,,,&lt;BR /&gt;.INSERT FEATURES&lt;BR /&gt;QUANTITY/1&lt;BR /&gt;FEATURE/VMP OCTEL&lt;BR /&gt;.END_INSERT&lt;BR /&gt;.EOR&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;close IN, OUT, AC_OUT, ERR;&lt;/IN&gt;</description>
      <pubDate>Tue, 25 May 2010 20:08:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-read-in-line-to-variable-in-script/m-p/4637398#M39996</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2010-05-25T20:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Perl read in line to variable in script</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/perl-read-in-line-to-variable-in-script/m-p/4637399#M39997</link>
      <description>Ratzie, &lt;BR /&gt;&lt;BR /&gt;------------------- tmp.pl -------&lt;BR /&gt;use warnings;&lt;BR /&gt;print ".LOG YES\n\n";&lt;BR /&gt;while(&amp;lt;&amp;gt;) {&lt;BR /&gt;chomp;&lt;BR /&gt;print &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;.BEGIN&lt;BR /&gt;UPDATE/$_,,,&lt;BR /&gt;.INSERT FEATURES&lt;BR /&gt;QUANTITY/1&lt;BR /&gt;FEATURE/VMP OCTEL&lt;BR /&gt;.END_INSERT&lt;BR /&gt;.EOR&lt;BR /&gt;EOF&lt;BR /&gt;}&lt;BR /&gt;------------------ tmp.tmp ----------&lt;BR /&gt;1234&lt;BR /&gt;5678&lt;BR /&gt;1231212312&lt;BR /&gt;--------- $ perl tmp.pl tmp.tmp -------&lt;BR /&gt;.BEGIN&lt;BR /&gt;UPDATE/1234,,,&lt;BR /&gt;.INSERT FEATURES&lt;BR /&gt;QUANTITY/1&lt;BR /&gt;FEATURE/VMP OCTEL&lt;BR /&gt;.END_INSERT&lt;BR /&gt;.EOR&lt;BR /&gt;&lt;BR /&gt;.BEGIN&lt;BR /&gt;UPDATE/5678,,,&lt;BR /&gt;.INSERT FEATURES&lt;BR /&gt;&lt;BR /&gt;&lt;SNIP&gt;&lt;BR /&gt; --------------------------------------&lt;BR /&gt;&lt;BR /&gt;Ratzie, if the above does not guide you towards a fix, then can you try that post again with a little more feeling?&lt;BR /&gt;&lt;BR /&gt;What is the actual problem?&lt;BR /&gt;&lt;BR /&gt;Do you really every expect the output to have two identical chunks as you show, or is that an unfortunate (lazy) example?&lt;BR /&gt;&lt;BR /&gt;What does the input file look like?&lt;BR /&gt;&lt;BR /&gt;What should the second output file look like? (just a log of numbers as read from input?)&lt;BR /&gt;&lt;BR /&gt;Where does '$tn' come from? &lt;BR /&gt;transformed from $_ ?&lt;BR /&gt;How is $_ from while (&lt;IN&gt;) ever used?&lt;BR /&gt;&lt;BR /&gt;I like the &amp;lt;&amp;lt; EOF usage for bulk text, but you do not show its FINAL usage... the EOF string itself&lt;BR /&gt;&lt;BR /&gt;As you try to answer the above please consider doubling up the dat in a TEXT file to be attached such that no details get lost in formatting.&lt;BR /&gt;&lt;BR /&gt;Finally... why/how is this an OpenVMS or HP question and no just a 'perl scripters beginners' forum question (assuming such beast exists)&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;/IN&gt;&lt;/SNIP&gt;</description>
      <pubDate>Tue, 25 May 2010 20:13:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/perl-read-in-line-to-variable-in-script/m-p/4637399#M39997</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-05-25T20:13:06Z</dc:date>
    </item>
  </channel>
</rss>

