<?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 Help needed in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299520#M715809</link>
    <description>A slip of your^wmy pen. I left in your old naming in the open call here:&lt;BR /&gt;&lt;BR /&gt;if (/^SWBAMSFR/) {&lt;BR /&gt;$count++;&lt;BR /&gt;my $name = "$uniq-$count.$testfile";&lt;BR /&gt;print STDERR "Test: New split name $name1\n";&lt;BR /&gt;$outfile and close $outfile;&lt;BR /&gt;open $outfile, "&amp;gt;$name1" or die "Test: can not create $name";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;change $name1 to $name, and you should be fine.&lt;BR /&gt;Now insert those two 'use' statements in front of the script, and it would have clearly stated the error, I'm sure&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
    <pubDate>Tue, 08 Jun 2004 17:53:14 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2004-06-08T17:53:14Z</dc:date>
    <item>
      <title>Perl Help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299515#M715804</link>
      <description>I used perl script from forum: split.pl to generate 2 separate file under if-condition checking. The reason is I need to check region (TW/FR...) to recognize for production or testing. The new script can output 2 separate file but empty record.  Can I use "$pname" for print statement. Please advice.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$onefile = shift or die " please provide filename in timestamp.filename format";&lt;BR /&gt;($uniq,$type)=split(/\./,$onefile);&lt;BR /&gt;$testfile = "testfile";&lt;BR /&gt;open (OLD,"&amp;lt;$onefile") or die " Could not open file: $onefile";&lt;BR /&gt;while (&lt;OLD&gt;) {&lt;BR /&gt;      if (/^SWBAMSTW/) {&lt;BR /&gt;      $count++;&lt;BR /&gt;      $name = $uniq."-".$count.".".$type;&lt;BR /&gt;      print "Prod: New split name $name\n";&lt;BR /&gt;      open (NEW,"&amp;gt;$name") or die "Prod: can not create $name";&lt;BR /&gt;      $pname = "NEW";&lt;BR /&gt;      } &lt;BR /&gt;      if (/^SWBAMSFR/) {&lt;BR /&gt;      $count++;&lt;BR /&gt;      $name1 = $uniq."-".$count.".".$testfile;&lt;BR /&gt;      print "Test : New split name $name1\n";&lt;BR /&gt;      open (NEW1,"&amp;gt;$name1") or die "Test: can not create $name1";&lt;BR /&gt;      $pname = "NEW1";&lt;BR /&gt;      } &lt;BR /&gt;die "no initial seperator found" unless ($count);&lt;BR /&gt;print $pname;&lt;BR /&gt;print "loop\n";&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/OLD&gt;</description>
      <pubDate>Tue, 08 Jun 2004 15:02:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299515#M715804</guid>
      <dc:creator>Mike_Ca Li</dc:creator>
      <dc:date>2004-06-08T15:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299516#M715805</link>
      <description>using $pname won't work. This probably will&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;my $onefile = shift or die " please provide filename in timestamp.filename format";&lt;BR /&gt;my ($uniq, $type) = split m/\./, $onefile, 2;&lt;BR /&gt;my $testfile = "testfile";&lt;BR /&gt;open my $old, "&amp;lt;$onefile" or die " Could not &lt;BR /&gt;my ($count, $outfile) = (0);&lt;BR /&gt;open file: $onefile";&lt;BR /&gt;while (&amp;lt;$old&amp;gt;) {&lt;BR /&gt;if (/^SWBAMSTW/) {&lt;BR /&gt;$count++;&lt;BR /&gt;$name = "$uniq-$count.$type";&lt;BR /&gt;print STDERR "Prod: New split name $name\n";&lt;BR /&gt;$outfile and close $outfile;&lt;BR /&gt;open $outfile, "&amp;gt;$name" or die "Prod: can not create $name";&lt;BR /&gt;} &lt;BR /&gt;if (/^SWBAMSFR/) {&lt;BR /&gt;$count++;&lt;BR /&gt;my $name = "$uniq-$count.$testfile";&lt;BR /&gt;print STDERR "Test: New split name $name1\n";&lt;BR /&gt;$outfile and close $outfile;&lt;BR /&gt;open $outfile, "&amp;gt;$name1" or die "Test: can not create $name";&lt;BR /&gt;}&lt;BR /&gt;$count or die "no initial seperator found";&lt;BR /&gt;print $outfile;&lt;BR /&gt;print STDERR "loop\n";&lt;BR /&gt;}&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;HTH Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Tue, 08 Jun 2004 15:26:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299516#M715805</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-08T15:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299517#M715806</link>
      <description>I would handle it thus(but i am not a maven).&lt;BR /&gt;&lt;BR /&gt;two file handles&lt;BR /&gt;&lt;BR /&gt; open (NEW1,"&amp;gt;$name") or die "Prod: can not create $name";&lt;BR /&gt;&lt;BR /&gt; open (NEW2,"&amp;gt;$fname") or die "Prod: can not create $fname";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You have two file handles open and then you write conditionally to whichever file you need.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 08 Jun 2004 15:32:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299517#M715806</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-06-08T15:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299518#M715807</link>
      <description>And most (beginner) errors are caught and verbosely explained when sarting your script with&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;and for the real unwary&lt;BR /&gt;&lt;BR /&gt;use diagnostics;&lt;BR /&gt;&lt;BR /&gt;this does the same as&lt;BR /&gt;&lt;BR /&gt;# splain "error message"&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ who doen't know what a maven is :) ]</description>
      <pubDate>Tue, 08 Jun 2004 15:41:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299518#M715807</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-08T15:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299519#M715808</link>
      <description>Hi:&lt;BR /&gt;I still don't understand the more than 1 file handle issue. I provide test input file. Pls advise. Thanks. &lt;BR /&gt;Log of a run:&lt;BR /&gt;Prod: New split name proto-1.txt&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;loop&lt;BR /&gt;Test: New split name&lt;BR /&gt;Test: can not create proto-2.testfile at split2.pl line 20, &amp;lt;$old&amp;gt; line 12.&lt;BR /&gt;GLOB(0x225114)GLOB(0x225114)GLOB(0x225114)GLOB(0x225114)GLOB(0x225114)GLOB(0x225&lt;BR /&gt;114)GLOB(0x225114)GLOB(0x225114)GLOB(0x225114)GLOB(0x225114)GLOB(0x225114)</description>
      <pubDate>Tue, 08 Jun 2004 15:50:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299519#M715808</guid>
      <dc:creator>Mike_Ca Li</dc:creator>
      <dc:date>2004-06-08T15:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299520#M715809</link>
      <description>A slip of your^wmy pen. I left in your old naming in the open call here:&lt;BR /&gt;&lt;BR /&gt;if (/^SWBAMSFR/) {&lt;BR /&gt;$count++;&lt;BR /&gt;my $name = "$uniq-$count.$testfile";&lt;BR /&gt;print STDERR "Test: New split name $name1\n";&lt;BR /&gt;$outfile and close $outfile;&lt;BR /&gt;open $outfile, "&amp;gt;$name1" or die "Test: can not create $name";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;change $name1 to $name, and you should be fine.&lt;BR /&gt;Now insert those two 'use' statements in front of the script, and it would have clearly stated the error, I'm sure&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Tue, 08 Jun 2004 17:53:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299520#M715809</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-08T17:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299521#M715810</link>
      <description>The safest way to assign a filehandle to a scalar is typeglobbing. Therefore you better use:&lt;BR /&gt;&lt;BR /&gt;$pname=*NEW ;&lt;BR /&gt;&lt;BR /&gt;and&lt;BR /&gt;&lt;BR /&gt;$pname=*NEW1 ;&lt;BR /&gt;&lt;BR /&gt;(But what you are doing must work except if you are using strict-refs)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now, if you want to print something to a&lt;BR /&gt;file "print" must understand that you want that.&lt;BR /&gt;&lt;BR /&gt;Use&lt;BR /&gt;&lt;BR /&gt;print $pname $_ ;&lt;BR /&gt;&lt;BR /&gt;With these minor changes I ran your script against your testfile, which downloaded as&lt;BR /&gt;&lt;BR /&gt;112028.txt and obtained&lt;BR /&gt;&lt;BR /&gt;112028-1.testfile (855 bytes)&lt;BR /&gt;&lt;BR /&gt;112028-2.txt (2181 bytes)&lt;BR /&gt;&lt;BR /&gt;112028-3.testfile (352 bytes)&lt;BR /&gt;&lt;BR /&gt;112028-4.txt (472 bytes)&lt;BR /&gt;&lt;BR /&gt;I suggest a visit to&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.perldoc.com/perl5.8.4/pod/perlfaq5.html" target="_blank"&gt;http://www.perldoc.com/perl5.8.4/pod/perlfaq5.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Jun 2004 08:04:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-help-needed/m-p/3299521#M715810</guid>
      <dc:creator>Miguel Covas</dc:creator>
      <dc:date>2004-06-09T08:04:19Z</dc:date>
    </item>
  </channel>
</rss>

