Click here to get back home

Problem with loop control LAST exiting prematurely

 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
Problem with loop control LAST exiting prematurely Rodion 03-18-2008
Posted by Frank Seitz on March 18, 2008, 4:09 pm
Please log in for more thread options
Lawrence Statton wrote:
>>
>>If you are doing the testing using numeric comparison, then they are equal.
>>
>>print "equal" if '0567' == '567';
>
> Does not print "equal"
>
> However
>
> perl -le 'print "equal" if '0567' == '375''
>
> Does.

You should test your programs!

> Why can't programmers tell Haloween from Christmas?
>
> Because OCT 31 == DEC 25

$ perldoc -f dec
No documentation for perl function `dec' found

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Posted by Lawrence Statton on March 18, 2008, 4:17 pm
Please log in for more thread options
> Lawrence Statton wrote:
> > However
> >
> > perl -le 'print "equal" if '0567' == '375''
> >
> > Does.
>
> You should test your programs!
>

lawrence@hummer - /tmp % perl -le 'print "equal" if '0567' == '375''
equal

--
        Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
place them into the correct order.

Posted by Frank Seitz on March 18, 2008, 4:46 pm
Please log in for more thread options
Lawrence Statton wrote:
>>
>>You should test your programs!
>
> lawrence@hummer - /tmp % perl -le 'print "equal" if '0567' == '375''
> equal

You're right, but it depends on the shell.

% perl
print "equal\n" if '0567' == '375'
^D
%

% perl
print "equal\n" if '0567' == '567'
^D
equal
%

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Posted by Ted Zlatanov on March 26, 2008, 6:18 pm
Please log in for more thread options

>> Why can't programmers tell Haloween from Christmas?
>>
>> Because OCT 31 == DEC 25

FS> $ perldoc -f dec
FS> No documentation for perl function `dec' found

Obviously you needed "perldoc -f DEC" :)

Ted

Similar ThreadsPosted
Re: stuck in a control loop October 24, 2007, 3:05 am
What does "exit the block or routine with a loop control operator" mean? July 24, 2004, 4:17 am
prematurely closed filehandle June 29, 2006, 11:02 am
Problem expanding filenames in loop June 23, 2008, 2:43 pm
Exiting without printing December 22, 2005, 8:48 pm
executing code without exiting the interpreter April 1, 2007, 4:35 pm
How can I prevent perl from exiting during a network error? May 8, 2005, 9:32 am
How to stop perl from exiting when stat($_)->size fails February 15, 2006, 11:50 am
process control September 28, 2004, 12:12 am
How to control version of OS September 27, 2005, 1:52 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap