<?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 A little improvement to my webinput perl scripts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282745#M715499</link>
    <description>I have some perl scripts that take input from a web page and process them into valid html documents.&lt;BR /&gt;&lt;BR /&gt;It works pretty well right now.&lt;BR /&gt;&lt;BR /&gt;I strip out the line feeds as follows so I can put them in with print statements later:&lt;BR /&gt;&lt;BR /&gt;chop ($filedata) if ($filedata =~/\n$/);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In the output file get the following results&lt;BR /&gt;&lt;BR /&gt;this the data^M&lt;BR /&gt;&lt;BR /&gt;This ^M is a single character and I'd like to strip it out.&lt;BR /&gt;&lt;BR /&gt;I know I can do it after the script run with the dos2unix command but I'd rather strip it in the program.&lt;BR /&gt;&lt;BR /&gt;I imagine its another chop statement. I can't begin to figure out what it should be.&lt;BR /&gt;&lt;BR /&gt;Bunny for tested code or an explanation as to why I can't do it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Thu, 20 May 2004 22:29:47 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2004-05-20T22:29:47Z</dc:date>
    <item>
      <title>A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282745#M715499</link>
      <description>I have some perl scripts that take input from a web page and process them into valid html documents.&lt;BR /&gt;&lt;BR /&gt;It works pretty well right now.&lt;BR /&gt;&lt;BR /&gt;I strip out the line feeds as follows so I can put them in with print statements later:&lt;BR /&gt;&lt;BR /&gt;chop ($filedata) if ($filedata =~/\n$/);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In the output file get the following results&lt;BR /&gt;&lt;BR /&gt;this the data^M&lt;BR /&gt;&lt;BR /&gt;This ^M is a single character and I'd like to strip it out.&lt;BR /&gt;&lt;BR /&gt;I know I can do it after the script run with the dos2unix command but I'd rather strip it in the program.&lt;BR /&gt;&lt;BR /&gt;I imagine its another chop statement. I can't begin to figure out what it should be.&lt;BR /&gt;&lt;BR /&gt;Bunny for tested code or an explanation as to why I can't do it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 20 May 2004 22:29:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282745#M715499</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-20T22:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282746#M715500</link>
      <description>Steven,&lt;BR /&gt;&lt;BR /&gt;This is not recently tested but I remember running into a situtaion like this in a 7 line perl code (this is the extent of my perl capacity goes to tell you the truth) but instead of chop, I remember using chomp to eliminate the trailing carriage return character.&lt;BR /&gt;&lt;BR /&gt;Hope it helps.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 20 May 2004 23:20:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282746#M715500</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2004-05-20T23:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282747#M715501</link>
      <description>i would guess why this isn't working is that ms-dos end of line is \r\n$.  and just doing a chop is leaving the \r.&lt;BR /&gt;&lt;BR /&gt;you can use chomp to remove a substring at the end of a line.  $\ specifies the substring. or $INPUT_RECORD_SEPARATOR if you use English module. &lt;BR /&gt;</description>
      <pubDate>Thu, 20 May 2004 23:45:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282747#M715501</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-05-20T23:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282748#M715502</link>
      <description>Attaching a sample output file.&lt;BR /&gt;&lt;BR /&gt;A bunny for a working chomp command.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 21 May 2004 06:50:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282748#M715502</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T06:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282749#M715503</link>
      <description>Attaching a sample output file.&lt;BR /&gt;&lt;BR /&gt;A bunny for a working chomp command.&lt;BR /&gt;&lt;BR /&gt;attaching a sample&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 21 May 2004 06:51:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282749#M715503</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T06:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282750#M715504</link>
      <description>^M is considered whitespace to perl, you can strip it off by doing a:&lt;BR /&gt;&lt;BR /&gt;$filedata =~ s/\s+$//;</description>
      <pubDate>Fri, 21 May 2004 07:02:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282750#M715504</guid>
      <dc:creator>Ken Penland_1</dc:creator>
      <dc:date>2004-05-21T07:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282751#M715505</link>
      <description>Will something like this work?&lt;BR /&gt;&lt;BR /&gt;open(INF,"../links.txt");&lt;BR /&gt;@data = &lt;INF&gt;;&lt;BR /&gt;close(INF);&lt;BR /&gt;foreach $i (@data) {&lt;BR /&gt;   chomp($i);&lt;BR /&gt;($name,$heading,$text) = split(/\|/,$i);&lt;BR /&gt;print "$heading\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;/INF&gt;</description>
      <pubDate>Fri, 21 May 2004 08:03:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282751#M715505</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-05-21T08:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282752#M715506</link>
      <description>Hi SEP,&lt;BR /&gt; &lt;BR /&gt;How about (as suggested by curt)&lt;BR /&gt; &lt;BR /&gt;open FILE, "filename" or die "oh no, not again\n";&lt;BR /&gt;&lt;BR /&gt;$/="^M";&lt;BR /&gt;&lt;BR /&gt;while(&lt;FILE&gt;){&lt;BR /&gt;        chomp;&lt;BR /&gt;        print;&lt;BR /&gt;}&lt;BR /&gt;&lt;/FILE&gt;</description>
      <pubDate>Fri, 21 May 2004 08:16:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282752#M715506</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-05-21T08:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282753#M715507</link>
      <description>These ideas look wonderful.&lt;BR /&gt;&lt;BR /&gt;I will be trying them late this afternoon.&lt;BR /&gt;&lt;BR /&gt;I'm concerned that Ken's code will remove all whitespaces including the spaces between words.&lt;BR /&gt;&lt;BR /&gt;Since the program is already runnning, my perference if possible is to add a chomp command to the existing statement so I don't have to execute a secondd program.&lt;BR /&gt;&lt;BR /&gt;Perhaps change:&lt;BR /&gt;chop ($filedata) if ($filedata =~/\n$/);&lt;BR /&gt;to&lt;BR /&gt;chop ($filedata) if ($filedata =~/^M\n$/);&lt;BR /&gt;&lt;BR /&gt;except I know its not carat M, its a single character taht I don't know the escape code for.&lt;BR /&gt;&lt;BR /&gt;Thanks. If there are other ideas, I'll be happy to try them.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Fri, 21 May 2004 08:22:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282753#M715507</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T08:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282754#M715508</link>
      <description>what does&lt;BR /&gt;&lt;BR /&gt;$\="\r\n";&lt;BR /&gt;chomp(filedata);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;do for you</description>
      <pubDate>Fri, 21 May 2004 08:28:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282754#M715508</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-05-21T08:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282755#M715509</link>
      <description>Well Ken, its not a whitespace I guess.  Tried your idea no joy. Seven points for the try.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 21 May 2004 08:29:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282755#M715509</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T08:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282756#M715510</link>
      <description>well chop only removes the last character.  so&lt;BR /&gt;chop ($filedata) if ($filedata =~/^M\n$/);&lt;BR /&gt;&lt;BR /&gt;is only going to remove the \n. leaving the \r. so, your going to still have the same issue that you are now.</description>
      <pubDate>Fri, 21 May 2004 08:35:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282756#M715510</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-05-21T08:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282757#M715511</link>
      <description>SEP, you don't need the test.   If you have set $/ to "^M^J" or possibly just "\r\n" then chomp won't do anything if they are not there.&lt;BR /&gt; &lt;BR /&gt;Apologies though, my little snippet above forgot that there needs to be a line feed in there too :)</description>
      <pubDate>Fri, 21 May 2004 08:36:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282757#M715511</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-05-21T08:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282758#M715512</link>
      <description>Kurt&lt;BR /&gt;&lt;BR /&gt;$\="\r\n";&lt;BR /&gt;chomp(filedata);&lt;BR /&gt;&lt;BR /&gt;results in an extra ^M after each line.&lt;BR /&gt;&lt;BR /&gt;I think this is significant.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 21 May 2004 08:48:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282758#M715512</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T08:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282759#M715513</link>
      <description>Okay to be honest, the ^M is not so bad.&lt;BR /&gt;&lt;BR /&gt;It was interfering with the following problem.&lt;BR /&gt;&lt;BR /&gt;I have a line of data that looks like this.&lt;BR /&gt;&lt;BR /&gt;* * *^M&lt;BR /&gt;&lt;BR /&gt;I wanted to test for text &lt;BR /&gt;&lt;BR /&gt;if ( $filedata eq "* * *") {&lt;BR /&gt;# process differently&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I can close this thread if i can reliabily test the first character of the array for an asterisk and take action.&lt;BR /&gt;&lt;BR /&gt;That code will end this with a bunny.&lt;BR /&gt;&lt;BR /&gt;Got a meeting, point assignment after.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 21 May 2004 08:58:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282759#M715513</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T08:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282760#M715514</link>
      <description>if ( $filedata=~/^\*/){&lt;BR /&gt; #process differently&lt;BR /&gt;}</description>
      <pubDate>Fri, 21 May 2004 09:16:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282760#M715514</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-05-21T09:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282761#M715515</link>
      <description>See "perldoc -f chomp", "perldoc -f chop", "perldoc perlvar", "perldoc perlop".&lt;BR /&gt; &lt;BR /&gt;The chomp POD says that chomp() will chop off any string held in the input separator varaible $/.&lt;BR /&gt;On Win32 the line separator is the sequence of \r\n  or ^M^J.&lt;BR /&gt;Perl should automagically take care of the propper separator.&lt;BR /&gt;But to be explicit you could assign this char sequence to $/ (better localize $/)&lt;BR /&gt;e.g.&lt;BR /&gt;{ local $/ = "\r\n";&lt;BR /&gt;# parsing, chomping here&lt;BR /&gt;}&lt;BR /&gt;If you prefer you could as well use the octal or hex reps.&lt;BR /&gt; &lt;BR /&gt;$/ = "\015\012";&lt;BR /&gt; &lt;BR /&gt;or even this might work&lt;BR /&gt; &lt;BR /&gt;$/ = "\cM\cJ";&lt;BR /&gt; &lt;BR /&gt;To get rid of carriage returns it's more efficient to use the transliterate operator as known from awk (tr or y) than a regexp.&lt;BR /&gt; &lt;BR /&gt;while (&lt;FH&gt;) {&lt;BR /&gt;tr/\015//d;&lt;BR /&gt;...&lt;BR /&gt;}&lt;BR /&gt;&lt;/FH&gt;</description>
      <pubDate>Fri, 21 May 2004 09:17:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282761#M715515</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-05-21T09:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282762#M715516</link>
      <description>Mark Grant's last idea worked.&lt;BR /&gt;&lt;BR /&gt;I'm still going to try to strip that ^M but I've accomplished what I need on this one.&lt;BR /&gt;&lt;BR /&gt;dos2unix works fine as a final processing step.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 21 May 2004 09:26:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282762#M715516</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T09:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282763#M715517</link>
      <description>put the aterisk in a character class and test for one ore more times occurrences&lt;BR /&gt; &lt;BR /&gt;while (&lt;FH&gt;) {&lt;BR /&gt;if (/[*]+/) {&lt;BR /&gt;# do something&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;similarily, treating only lines that don't contain carriage returns&lt;BR /&gt; &lt;BR /&gt;unless (/[\r]/) {&lt;BR /&gt;}&lt;/FH&gt;</description>
      <pubDate>Fri, 21 May 2004 09:29:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282763#M715517</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-05-21T09:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: A little improvement to my webinput perl scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282764#M715518</link>
      <description>RALPH!&lt;BR /&gt;&lt;BR /&gt;You DUDE!&lt;BR /&gt;&lt;BR /&gt;You got it.&lt;BR /&gt;&lt;BR /&gt;after the chop&lt;BR /&gt;&lt;BR /&gt;$/="\cM";&lt;BR /&gt;chomp ( $filedata );&lt;BR /&gt;&lt;BR /&gt;I know I could probably do it in one line of code but I don't care.&lt;BR /&gt;&lt;BR /&gt;THREAD CLOSED!&lt;BR /&gt;&lt;BR /&gt;AWESOME&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 21 May 2004 09:32:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/a-little-improvement-to-my-webinput-perl-scripts/m-p/3282764#M715518</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-05-21T09:32:27Z</dc:date>
    </item>
  </channel>
</rss>

