Chas Owens wrote:
> On 4/19/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
>> Chas Owens wrote:
>> > Yes, foreach was aliased to for for backwards compatibility,
>>
>> Huh? Do you have something to back up that claim?
>
> Well, perlsyn* says
> The "foreach" keyword is actually a synonym for the "for" keyword, so
> you can use "foreach" for readability or "for" for brevity. (Or
> because the Bourne shell is more familiar to you than csh, so writing
> "for" comes more naturally.)
>
> But Synopsis 4* says
> There is no foreach statement any more. It's always spelled for
> in Perl 6,
> so it always takes a list as an argument
>
> So, you can either start training yourself to say for instead of
> foreach now or wait for culture shock down the road.
I see nothing about backwards compatibility in there? ;-)
>> > but, like
>> > telnet and rsh, it should not be used in new code.
>>
>> Really? I assume you mean the protocols and not the programs?
>
> The protocols and the programs (unless you are using the telnet
> program for manual testing of server protocols).
Yes, the telnet program is a lot more useful than just using the telnet
protocol.
[ snip ]
> Which still proves the point, for(;;) is no better than while (1) for
> infinite loops. In my opinion while is better since I will eventually
> realize that this should not be an infinite loop.
>
> my $continue = 1;
> $SIG{__TERM__} = sub { $continue = 0 };
> while ($continue} {
> }
my $continue = 1;
$SIG{ __TERM__ } = sub { $continue = 0 };
for ( ;$continue; } {
}
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/