<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Why the Perl script flash error and print weird lines once change the operating system?]]></title>
	<link>https://bioinformaticsonline.com/answers/view/1118/why-the-perl-script-flash-error-and-print-weird-lines-once-change-the-operating-system?</link>
	<atom:link href="https://bioinformaticsonline.com/answers/view/1118/why-the-perl-script-flash-error-and-print-weird-lines-once-change-the-operating-system?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/answers/view/1118/why-the-perl-script-flash-error-and-print-weird-lines-once-change-the-operating-system</guid>
	<pubDate>Thu, 18 Jul 2013 10:52:41 -0500</pubDate>
	<link>https://bioinformaticsonline.com/answers/view/1118/why-the-perl-script-flash-error-and-print-weird-lines-once-change-the-operating-system</link>
	<title><![CDATA[Why the Perl script flash error and print weird lines once change the operating system?]]></title>
	<description><![CDATA[<p>Hi Bioinformatician, I am working on a small script which read a file and extract the gene coordinates. It works fine when I run on linux OS but in Window OS it print some weird sign, and also does not print the expected result. Following are the code for your reference.</p><blockquote><p>#!/usr/bin/perl<br />use strict; <br />use warnings;<br /><br />&nbsp;&nbsp;&nbsp; my $fileIn = $ARGV[0];<br />&nbsp;&nbsp;&nbsp; my $OutFile = $ARGV[1];<br />&nbsp;&nbsp;&nbsp; open my $fh, '&lt;', $fileIn or die "could not open $fileIn for read\n";<br />&nbsp;&nbsp;&nbsp; open OUTFILE, "&gt;" , $OutFile or die "$0: open $OutFile: $!";<br />&nbsp;&nbsp;&nbsp; while (&lt;$fh&gt;) {<br />&nbsp;&nbsp; &nbsp;chomp $_;<br />&nbsp;&nbsp; &nbsp;my $line=trim($_);<br />&nbsp;&nbsp; &nbsp;$line =~ s/(\.\.|\s+)/\t/g; <br />&nbsp;&nbsp; &nbsp;$line =~ s/\(|\)/\t/g;<br />&nbsp;&nbsp; &nbsp;my $number=$.;<br />&nbsp;&nbsp; &nbsp;my @tmp=split /\t/, $line;<br />&nbsp;&nbsp; &nbsp;if($tmp[2] ne 'complement') { <br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my @newtmp = split(/gene/, $line);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my $newline=$newtmp[1];<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my @tmp2=split /\t/, $newline;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;my $head="gene"; <br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print OUTFILE "$number\t$head\t\t$tmp2[1]\t$tmp2[2]\n";<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;else {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;print OUTFILE "$number\t$tmp[1]\t$tmp[2]\t$tmp[3]\t$tmp[4]\n";<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />}<br /><br /></p><p># Perl trim function to remove whitespace from the start and end of the string<br />sub trim($) {<br />&nbsp;&nbsp; &nbsp;my $string = shift;<br />&nbsp;&nbsp; &nbsp;$string =~ s/^[\t\s]+//;<br />&nbsp;&nbsp; &nbsp;$string =~ s/[\t\s]+$//;<br />&nbsp;&nbsp; &nbsp;return $string;<br />}</p></blockquote>]]></description>
	<dc:creator>Neel</dc:creator>
</item>

</channel>
</rss>