Click here to get back home

Re: USEFUL perl SCRIPT: NTP verifier

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Re: USEFUL perl SCRIPT: NTP verifier Ignoramus25819 01-15-2008
Posted by Ignoramus25819 on January 15, 2008, 12:59 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Posted by John Bokma on January 15, 2008, 2:21 pm
Please log in for more thread options

[ my $bad = undef;

> Yep. This also means "no, I did not forget to assign its value".

Like I already wrote YMMV, but IMO using mixed "boolean" states (undef/1)
is not done, and hence I would have avoided the whole issue by using:

my $bad = 0;

(and probably would have picked a better variable name as well: what is
bad?)


--
John

http://johnbokma.com/mexit/

Similar ThreadsPosted
Re: USEFUL perl SCRIPT: NTP verifier January 15, 2008, 1:55 pm
Re: USEFUL perl SCRIPT: NTP verifier January 15, 2008, 2:57 pm
Re: USEFUL perl SCRIPT: NTP verifier January 15, 2008, 3:51 pm
Re: USEFUL perl SCRIPT: NTP verifier January 15, 2008, 5:25 pm
Re: USEFUL perl SCRIPT: NTP verifier January 16, 2008, 4:54 am
what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server? April 8, 2007, 11:38 pm
Problem in passing values to perl script using another perl script August 10, 2005, 12:32 pm
Issue in executing more than one perl script from Single perl script November 1, 2007, 2:52 am
How to generate radio buttons in Perl/CGI script with call to shell script? November 23, 2007, 11:24 pm
FAQ: I {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible? October 6, 2004, 4:54 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap