🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #1362

Re: Problema en un for de PERL

#1362
From: David Serrano (Hue-Bond)
Date: Sat, 21 Jan 2006 15:55
36 lines
1905 bytes
Olaf "El BLanco", vie20060120@21:56:54(CET):
>
> for ($a=0; $a<$max; print "\t$a", $a++) {}
> // Imprime 1 2 3 4 5 ... max. Muy bien... 

Discrepo:

$ perl
my $max = 6;
for ($a=0; $a<$max; print "\t$a", $a++) {}
__END__
        00      11      22      33      44      55$ _


> for ($a=0; $a<$max; $a++, print "\t$a") {}
> // Y me imprime 00 11 22 33 44... max-1max-1 ?  

Hmm... ¿no te habrás equivocado al escribir? ;)

$ perl
my $max = 6;
for ($a=0; $a<$max; $a++, print "\t$a") {}
__END__
        1       2       3       4       5       6$ _

En cualquier caso no necesitas el bloque vacío:

$ perl
my $max = 6;
print "\t$_" for 0..$max-1;
__END__
        0       1       2       3       4       5$ _


-- 
 David Serrano
Technical Details
Message-ID: <slrndt4mc6.n21.responder_solo_en_el_grupo@genus.hue-bond.info>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!news.antakira.com!antonio.escomposlinux.org!cernicalo.escomposlinux.org!escomposlinux.org!not-for-mail
References: <dqriqn$6sg$1@cormoran.emeteo.local>

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,3f5c6a29bebed5ff
X-Google-Attributes: gidf86c8,public
X-Google-Language: ENGLISH,UTF8
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!news.antakira.com!antonio.escomposlinux.org!cernicalo.escomposlinux.org!escomposlinux.org!not-for-mail
From: "David Serrano (Hue-Bond)" <responder_solo_en_el_grupo@yahoo.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Problema en un for de PERL
Date: Sat, 21 Jan 2006 15:55:50 +0000 (UTC)
Organization: I work for myself
Lines: 36
Message-ID: <slrndt4mc6.n21.responder_solo_en_el_grupo@genus.hue-bond.info>
References: <dqriqn$6sg$1@cormoran.emeteo.local>
NNTP-Posting-Host: 252.red-83-44-21.dynamicip.rima-tde.net
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: cormoran.emeteo.local 1137858950 13433 83.44.21.252 (21 Jan 2006 15:55:50 GMT)
X-Complaints-To: emeteo@escomposlinux.org
NNTP-Posting-Date: Sat, 21 Jan 2006 15:55:50 +0000 (UTC)
X-Message-Flag: Visit http://www.debian.org/
X-MSMail-Priority: High
Mail-Copies-To: nobody
User-Agent: slrn/0.9.8.1pl1 (Debian)